Class: PathInfo
Defined in: | src/path.coffee |
Overview
A representation of the information contained in a path expression. This class exposes the metadata available for this path, and is aware of class constraints placed upon it.
Instance Method Summary
- # (boolean) isRoot() Bound Whether or not this is a root path.
- # (boolean) isAttribute() Bound Whether or not this is a leaf path.
- # (boolean) isClass() Bound Whether or not this path represents one or more objects (i.e.
- # (boolean) isReference() Bound Whether or not this path is a reference field (could be collection).
- # (boolean) isReverseReference() Bound Whether or not this path is a reverse reference.
- # (boolean) isCollection() Bound Whether or not this path refers to a collection.
- # (boolean) containsCollection() Bound Whether or not any segment of this path refers to a collection.
- # (Table) getEndClass() Bound Get the Table object for this path (if root or reference, null if leaf).
- # (PathInfo) getParent() Bound Get the parent of this path.
- # (PathInfo) append(attr) Bound Adds a segment to this path.
- # (?) isa(clazz) Bound Analyses the inheritance hierarchy to determine if this path represents an instance of the provided class.
- # (Promise<String>) getDisplayName(cb) Bound Fetches the configured display name for this path from the server.
- # (Array<PathInfo>) getChildNodes() Bound Gets all the sub-paths of this class.
- # (Array<Descriptor>) allDescriptors() Bound
- # (String) toString() to {Model::makePath}
- # (boolean) equals(other) Overriden equals.
- # (String|Table) getType() Get the type of this path.
Constructor Details
#
(void)
constructor({root, model, descriptors, subclasses, displayName, ident})
Constructor of PathInfo objects. PathInfo objects are constructed by the model. You should not need to call this constructor yourself.
@param options The data used to construct this PathInfo object
Instance Method Details
#
(boolean)
isRoot()
Bound
Whether or not this is a root path.
#
(boolean)
isAttribute()
Bound
Whether or not this is a leaf path.
#
(boolean)
isClass()
Bound
Whether or not this path represents one or more objects (i.e. is not a leaf).
#
(boolean)
isReference()
Bound
Whether or not this path is a reference field (could be collection).
#
(boolean)
isReverseReference()
Bound
Whether or not this path is a reverse reference.
#
(boolean)
isCollection()
Bound
Whether or not this path refers to a collection.
#
(boolean)
containsCollection()
Bound
Whether or not any segment of this path refers to a collection.
#
(Table)
getEndClass()
Bound
Get the Table object for this path (if root or reference, null if leaf).
#
(PathInfo)
getParent()
Bound
Get the parent of this path. i.e., for Gene.proteins.name
returns Gene.proteins
exonSymbols = model.makePath('Gene.exons.symbol') exons = model.makePath('Gene.exons') exons.equals(exonSymbols.getParent()) //=> true
@throws [Error] if this path has not parent.
#
(PathInfo)
append(attr)
Bound
Adds a segment to this path. The segment must conform with the data model.
#
(?)
isa(clazz)
Bound
Analyses the inheritance hierarchy to determine if this path represents an instance of the provided class. eg: path = model.makePath('Gene.proteins') path.isa('Protein') //=> true path.isa('BioEntity') //=> true path.isa('Organism') //=> false path.append('name').isa('String') //=> true
#
(Promise<String>)
getDisplayName(cb)
Bound
Fetches the configured display name for this path from the server.
#
(Array<PathInfo>)
getChildNodes()
Bound
Gets all the sub-paths of this class. eg:
path = model.makePath('Gene') path.getChildNodes() //=> [PathInfo('Gene.name'), PathInfo('Gene.proteins')...]
#
(Array<Descriptor>)
allDescriptors()
Bound
#
(String)
toString()
to {Model::makePath}
#
(boolean)
equals(other)
Overriden equals.
#
(String|Table)
getType()
Get the type of this path. If the path represents a class or a reference, the class itself is returned, otherwise the name of the attribute type is returned, minus any "java.lang." prefix.