|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.intermine.pathquery.Path
public class Path
Object to represent a path through an InterMine model. Construction from a String validates against model.
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
LOG
|
| Constructor Summary | |
|---|---|
Path(Model model,
java.lang.String path)
Create a new Path object. |
|
Path(Model model,
java.lang.String stringPath,
java.util.Map<java.lang.String,java.lang.String> constraintMap)
Create a Path object using class constraints from a Map. |
|
| Method Summary | |
|---|---|
Path |
append(java.lang.String fieldName)
Return new Path that has this Path as its prefix and has fieldName as the last element. |
boolean |
containsCollections()
Return true if and only if any part of the path is a collection. |
boolean |
containsReferences()
Return true if and only if any part of the path is a reference. |
boolean |
endIsAttribute()
Return true if and only if the end of the path is an attribute. |
boolean |
endIsCollection()
Return true if and only if the end of the path is a collection. |
boolean |
endIsReference()
Return true if and only if the end of the path is a reference . |
boolean |
equals(java.lang.Object o)
|
java.util.List<ClassDescriptor> |
getElementClassDescriptors()
Return a List of the ClassDescriptor objects for each element of the path. |
java.util.List<java.lang.String> |
getElements()
Return a list of field names, one per path element (except for the first, which is a class). |
ClassDescriptor |
getEndClassDescriptor()
If the last element in the path is a reference or collection return the ClassDescriptor that the reference or collection references. |
FieldDescriptor |
getEndFieldDescriptor()
Return the FieldDescriptor of the last element in the path or null if the path has just one element. |
java.lang.Class<?> |
getEndType()
Return the type of the last element in the path, regardless of whether it is an attribute or a class. |
ClassDescriptor |
getLastClassDescriptor()
Returns the last ClassDescriptor in the path. |
java.lang.String |
getLastElement()
Return the last string element of this path, throw an exception of there is only one element, i.e. for 'Company.departments.manager' return 'manager'. |
Model |
getModel()
Return the model that this path is created for. |
java.lang.String |
getNoConstraintsString()
Required for jsp |
Path |
getPrefix()
Return a Path object that represents the prefix of this path, ie this Path without the last element. |
ClassDescriptor |
getSecondLastClassDescriptor()
Returns the second to last ClassDescriptor in the path. |
ClassDescriptor |
getStartClassDescriptor()
Return the ClassDescriptor of the first element in the path. |
java.util.Map<java.lang.String,java.lang.String> |
getSubClassConstraintPaths()
Returns a Map from simplified path string (with dots instead of colons, and no constraints) to constraint class name. |
int |
hashCode()
|
boolean |
isOnlyAttribute()
Return true if the Path does not contain references or collections |
boolean |
isRootPath()
Return true if this path represents just the starting class, e.g. |
java.lang.String |
toString()
Returns a representation of the Path as a String, with class constraint markers. |
java.lang.String |
toStringNoConstraints()
Returns a representation of the Path as a String, with no class constraint markers. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger LOG
| Constructor Detail |
|---|
public Path(Model model,
java.lang.String path)
throws PathException
model - the Model used to check ClassDescriptors and FieldDescriptorspath - a String of the form "Department.manager.name" or
"Department.employees[Manager].seniority"
PathException - thrown if there is a problem resolving the path eg. a reference doesn't
exist in the model
public Path(Model model,
java.lang.String stringPath,
java.util.Map<java.lang.String,java.lang.String> constraintMap)
throws PathException
model - the Model used to check ClassDescriptors and FieldDescriptorsstringPath - a String of the form "Department.manager.name"constraintMap - a Map from paths as string to class names - use when parts of the path
are constrained to be sub-classes
PathException - thrown if there is a problem resolving the path eg. a reference doesn't
exist in the model| Method Detail |
|---|
public boolean containsCollections()
public boolean containsReferences()
public boolean isOnlyAttribute()
public boolean endIsAttribute()
public boolean endIsCollection()
public boolean endIsReference()
public ClassDescriptor getStartClassDescriptor()
public FieldDescriptor getEndFieldDescriptor()
public ClassDescriptor getEndClassDescriptor()
public Path getPrefix()
public Path append(java.lang.String fieldName)
throws PathException
fieldName - the field name
PathException - if the resulting Path is not validpublic java.lang.Class<?> getEndType()
public ClassDescriptor getLastClassDescriptor()
public ClassDescriptor getSecondLastClassDescriptor()
public java.lang.String getLastElement()
public boolean isRootPath()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.util.List<java.lang.String> getElements()
public java.util.List<ClassDescriptor> getElementClassDescriptors()
public java.lang.String toStringNoConstraints()
public java.lang.String getNoConstraintsString()
public java.util.Map<java.lang.String,java.lang.String> getSubClassConstraintPaths()
public Model getModel()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||