Package org.intermine.pathquery
Class PathConstraint
- java.lang.Object
-
- org.intermine.pathquery.PathConstraint
-
- Direct Known Subclasses:
PathConstraintAttribute
,PathConstraintBag
,PathConstraintIds
,PathConstraintLookup
,PathConstraintLoop
,PathConstraintMultiValue
,PathConstraintNull
,PathConstraintSubclass
public abstract class PathConstraint extends java.lang.Object
Representation of a constraint in the PathQuery. All PathConstraint subclasses must be immutable.- Author:
- Matthew Wakeling
-
-
Field Summary
Fields Modifier and Type Field Description protected ConstraintOp
op
protected java.lang.String
path
-
Constructor Summary
Constructors Modifier Constructor Description protected
PathConstraint(java.lang.String path, ConstraintOp op)
Constructs a new PathConstraint.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getExtraValue(PathConstraint con)
A static method for getting the extra-value if there is one, or null if there is none to be got.static java.util.Collection<java.lang.Integer>
getIds(PathConstraint con)
Get the ids for a constraint.ConstraintOp
getOp()
Returns the operation that this constraint performs.java.lang.String
getPath()
Returns the path that this constraint is attached to.static java.lang.String
getType(PathConstraint con)
A static method to get the type of this constraint if it is a sub-class constraint, or otherwise return null.static java.lang.String
getValue(PathConstraint con)
A static method for accessing values without having to handle the subclasses manually.static java.util.Collection<java.lang.String>
getValues(PathConstraint con)
Get the values for a constraint.
-
-
-
Field Detail
-
path
protected java.lang.String path
-
op
protected ConstraintOp op
-
-
Constructor Detail
-
PathConstraint
protected PathConstraint(java.lang.String path, ConstraintOp op)
Constructs a new PathConstraint. You will need to call the constructor of a subclass of this abstract class. The path should be a normal path expression with dots separating the parts. Do not use colons to represent outer joins, and do not use square brackets to represent subclass constraints. The path will be checked for format, but can only be verified once inside a PathQuery object by the PathQuery.verifyQuery() method.- Parameters:
path
- the path that the constraint is attached toop
- the type of operation- Throws:
java.lang.NullPointerException
- if path or op are nulljava.lang.IllegalArgumentException
- if the path contains colons or square brackets, or is otherwise in a bad format
-
-
Method Detail
-
getPath
public java.lang.String getPath()
Returns the path that this constraint is attached to. The path is a normal path expression without colons or square brackets, and may not have been verified against a query.- Returns:
- a String path
-
getOp
public ConstraintOp getOp()
Returns the operation that this constraint performs.- Returns:
- a ConstraintOp
-
getValue
public static java.lang.String getValue(PathConstraint con)
A static method for accessing values without having to handle the subclasses manually.- Parameters:
con
- The constraint.- Returns:
- A string representing the value.
-
getExtraValue
public static java.lang.String getExtraValue(PathConstraint con)
A static method for getting the extra-value if there is one, or null if there is none to be got.- Parameters:
con
- The constraint to get the extra value of.- Returns:
- The constraint's extra-value, or null.
-
getValues
public static java.util.Collection<java.lang.String> getValues(PathConstraint con)
Get the values for a constraint.- Parameters:
con
- The constraint.- Returns:
- A collection of values. null if this makes no sense.
-
getIds
public static java.util.Collection<java.lang.Integer> getIds(PathConstraint con)
Get the ids for a constraint.- Parameters:
con
- The constraint.- Returns:
- A collection of ids. null if this makes no sense.
-
getType
public static java.lang.String getType(PathConstraint con)
A static method to get the type of this constraint if it is a sub-class constraint, or otherwise return null.- Parameters:
con
- The constraint to get the type of.- Returns:
- The type, or null.
-
-