Class DisplayPath
- java.lang.Object
-
- org.intermine.web.logic.querybuilder.DisplayPath
-
- Direct Known Subclasses:
SummaryPath
public class DisplayPath extends java.lang.Object
A small wrapper around Path with more jsp-accessible data.- Author:
- Matthew Wakeling
-
-
Constructor Summary
Constructors Constructor Description DisplayPath(Path path)
Constructs a new DisplayPath object from a Path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldDescriptor
getFieldDescriptor()
Return the last field descriptor (the last element) of the path.java.lang.String
getFieldName()
Returns the fieldname for this path.java.lang.String
getFriendlyName()
Returns the last element of the path.int
getIndentation()
Returns the number of elements in the path, where a simple class is zero.java.lang.String
getLastClassName()
Fetch the unqualified class name of the final class on this path, if the path represents an attribute this will be the parent class of that attribute.DisplayPath
getParent()
Returns a new DisplayPath that represents the parent path, or null if this path is just a root class.Path
getPath()
Return the underlying path object.java.lang.String
getPathString()
Returns the full path string for this path.java.lang.String
getType()
Returns the type of the value represented by this path, as a string.boolean
isAttribute()
Returns true if the path represents an attribute (rather than a class, reference, or collection).boolean
isCollection()
Returns true if the path represents a collection.boolean
isPrimitive()
Return true if the end element of the path is an attribute and the attribute is a primitive type.boolean
isReference()
Returns true if the path represents a reference.java.lang.String
toString()
Returns a representation of the Path as a String, with class constraint markers.
-
-
-
Constructor Detail
-
DisplayPath
public DisplayPath(Path path)
Constructs a new DisplayPath object from a Path.- Parameters:
path
- a Path to wrap
-
-
Method Detail
-
getPath
public Path getPath()
Return the underlying path object.- Returns:
- path the path object wrapped by this DisplayPath
-
getIndentation
public int getIndentation()
Returns the number of elements in the path, where a simple class is zero.- Returns:
- number of elements in path
-
getFriendlyName
public java.lang.String getFriendlyName()
Returns the last element of the path.- Returns:
- a String
-
getFieldDescriptor
public FieldDescriptor getFieldDescriptor()
Return the last field descriptor (the last element) of the path. If the path represents the root class, return null.- Returns:
- A field descriptor.
-
isAttribute
public boolean isAttribute()
Returns true if the path represents an attribute (rather than a class, reference, or collection).- Returns:
- a boolean
-
isReference
public boolean isReference()
Returns true if the path represents a reference.- Returns:
- a boolean
-
isCollection
public boolean isCollection()
Returns true if the path represents a collection.- Returns:
- a boolean
-
isPrimitive
public boolean isPrimitive()
Return true if the end element of the path is an attribute and the attribute is a primitive type.- Returns:
- true if path represents a primitive attribute
-
getPathString
public java.lang.String getPathString()
Returns the full path string for this path.- Returns:
- a String
-
getFieldName
public java.lang.String getFieldName()
Returns the fieldname for this path.- Returns:
- a String
-
getType
public java.lang.String getType()
Returns the type of the value represented by this path, as a string.- Returns:
- a String unqualified class name
-
getParent
public DisplayPath getParent()
Returns a new DisplayPath that represents the parent path, or null if this path is just a root class.- Returns:
- a new DisplayPath
-
getLastClassName
public java.lang.String getLastClassName()
Fetch the unqualified class name of the final class on this path, if the path represents an attribute this will be the parent class of that attribute. For example Company.name will return Company.- Returns:
- an unqualified class name
-
toString
public java.lang.String toString()
Returns a representation of the Path as a String, with class constraint markers. eg. "Department.employees[Manager].seniority"- Overrides:
toString
in classjava.lang.Object
-
-