type

Ref

@Js
@Serializable { simple=true }
const class Ref : Ref

Ref is used to model a record identifier and optional display string.

constructors

fromStr

Make with simple id

make

Construct with id string and optional display string.

makeWithDis

Construct with Ref id string and optional display string.

fields

defVal

Default is nullRef

nullRef

Null ref is "@null"

methods

dis

Return display value of target if available, otherwise id

equals

Equality is based on id only (not dis).

gen

Generate a unique Ref.

hash

Hash id

id

Identifier which does not include the leading @

isId

Return if the string is a valid Ref identifier.

isIdChar

Is the given character a valid id char

isNull

Null ref has id value of "null"?

toCode

Return "@id"

toId

Take an arbitrary string and convert into a safe Ref identifier.

toStr

String format is id which does not include the leading @.

Slot Details

defVal

const static Ref defVal := nullRef

Default is nullRef

dis

virtual override Str dis()

Return display value of target if available, otherwise id

equals

virtual override Bool equals(Obj? that)

Equality is based on id only (not dis).

fromStr

static new fromStr(Str id, Bool checked := true)

Make with simple id

gen

static Ref gen()

Generate a unique Ref.

hash

virtual override Int hash()

Hash id

id

virtual override Str id()

Identifier which does not include the leading @

isId

static Bool isId(Str n)

Return if the string is a valid Ref identifier. See isIdChar

isIdChar

static Bool isIdChar(Int char)

Is the given character a valid id char:

  • A - Z
  • a - z
  • 0 - 9
  • _ : - . ~

isNull

Bool isNull()

Null ref has id value of "null"?

make

static new make(Str id, Str? dis)

Construct with id string and optional display string.

makeWithDis

static new makeWithDis(Ref ref, Str? dis := null)

Construct with Ref id string and optional display string.

nullRef

const static Ref nullRef := Ref.<ctor>("null")

Null ref is "@null"

toCode

Str toCode()

Return "@id"

toId

static Str toId(Str n)

Take an arbitrary string and convert into a safe Ref identifier.

toStr

virtual override Str toStr()

String format is id which does not include the leading @. Use toCode to include leading @.