Ref
@Js
const class Ref : Obj
Ref is used to model an entity identifier and optional display string.
Make with simple id
Construct with Ref id string and optional display string
Construct with id string and optional display string
Null ref is "@null"
Default is nullRef
Is the given character a valid id char
Take an arbitrary string and convert into a safe Ref identifier
String format is id which does not include the leading @
Generate a unique Ref
Return if the string is a valid Ref identifier
Return "@id"
Equality is based on id only (not dis)
Null ref has id value of "null"?
Identifier which does not include the leading @
Is this a spec ref with double colons
Hash id
Return display value of target if available, otherwise id
const static Ref : defVal
Default is nullRef
Str dis()
Return display value of target if available, otherwise id
virtual Bool equals(Obj? that)
Equality is based on id only (not dis).
static new fromStr(Str id, Bool checked)
Make with simple id
static Ref gen()
Generate a unique Ref.
virtual Int hash()
Hash id
Str id()
Identifier which does not include the leading @
static Bool isId(Str n)
Return if the string is a valid Ref identifier. See isIdChar
static Bool isIdChar(Int char)
Is the given character a valid id char:
A-Za-z0-9_ : - . ~
Bool isNull()
Null ref has id value of "null"?
Bool isSpec()
Is this a spec ref with double colons
static new make(Str id, Str? dis)
Construct with id string and optional display string.
static new makeWithDis(Ref ref, Str? dis)
Construct with Ref id string and optional display string.
const static Ref : nullRef
Null ref is "@null"
Str toCode()
Return "@id"
static Str toId(Str n)
Take an arbitrary string and convert into a safe Ref identifier.
virtual Str toStr()
String format is id which does not include the leading @. Use toCode to include leading @.