Package org.intermine.objectstore.query
Class QueryField
- java.lang.Object
-
- org.intermine.objectstore.query.QueryField
-
- All Implemented Interfaces:
QueryEvaluable
,QueryNode
,QueryOrderable
,QuerySelectable
public class QueryField extends java.lang.Object implements QueryEvaluable
Represents a QueryClass field that is neither a collection or reference to another business object.- Author:
- Mark Woodbridge, Richard Smith, Matthew Wakeling
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
QueryField(FromElement qc, java.lang.String fieldName, java.lang.String secondFieldName, java.lang.Class<?> type)
Constructs a QueryField object - intended for cloning operations.QueryField(QueryClassBag qcb)
Constructs the id QueryField for the given QueryClassBag.QueryField(QueryClass qc, java.lang.String fieldName)
Constructs a QueryField representing the specified field of a QueryClassQueryField(Query q, QueryClass qc, java.lang.String fieldName)
Constructs a QueryField representing the specified field of the specified QueryClass, as seen outside the specified subquery.QueryField(Query q, QueryEvaluable v)
Constructs a QueryField representing the specified entry from the SELECT list of the specified subquery.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
Returns true if this is equal to the given object.int
getApproximateType()
Returns an integer representing the approximate type of this QueryEvaluable, in the case where an accurate type cannot be ascertained.java.lang.String
getFieldName()
Returns the name of the field.FromElement
getFromElement()
Gets the FromElement of which the field is a memberjava.lang.String
getSecondFieldName()
Returns the name of the second field.java.lang.Class<?>
getType()
Get Java type represented by this item.int
hashCode()
Returns a hash code for this object.java.lang.String
toString()
Produces a String, for debugging purposes.void
youAreType(java.lang.Class<?> cls)
Allows a caller to suggest to this object that it holds a value of a certain type.
-
-
-
Constructor Detail
-
QueryField
public QueryField(QueryClass qc, java.lang.String fieldName)
Constructs a QueryField representing the specified field of a QueryClass- Parameters:
qc
- the QueryClassfieldName
- the name of the relevant field- Throws:
java.lang.NullPointerException
- if the field name is nulljava.lang.IllegalArgumentException
- if the field is a reference, a collection or does not exist
-
QueryField
public QueryField(Query q, QueryClass qc, java.lang.String fieldName)
Constructs a QueryField representing the specified field of the specified QueryClass, as seen outside the specified subquery.- Parameters:
q
- the Query object that is the subqueryqc
- the QueryClass that the field is a member offieldName
- the name of the relevant field- Throws:
java.lang.NullPointerException
- if the field name is nulljava.lang.IllegalArgumentException
- if the field is a collection or does not exist
-
QueryField
public QueryField(Query q, QueryEvaluable v)
Constructs a QueryField representing the specified entry from the SELECT list of the specified subquery.- Parameters:
q
- the Query object that is the subqueryv
- the entry of the SELECT list- Throws:
java.lang.NullPointerException
- if the field name is null
-
QueryField
public QueryField(QueryClassBag qcb)
Constructs the id QueryField for the given QueryClassBag.- Parameters:
qcb
- the QueryClassBag
-
QueryField
protected QueryField(FromElement qc, java.lang.String fieldName, java.lang.String secondFieldName, java.lang.Class<?> type)
Constructs a QueryField object - intended for cloning operations.- Parameters:
qc
- the FromElementfieldName
- the first field namesecondFieldName
- the second field nametype
- the Class of the value
-
-
Method Detail
-
getFromElement
public FromElement getFromElement()
Gets the FromElement of which the field is a member- Returns:
- the FromElement
-
getType
public java.lang.Class<?> getType()
Get Java type represented by this item.- Specified by:
getType
in interfaceQueryOrderable
- Specified by:
getType
in interfaceQuerySelectable
- Returns:
- class describing the type
-
getFieldName
public java.lang.String getFieldName()
Returns the name of the field.- Returns:
- field name
-
getSecondFieldName
public java.lang.String getSecondFieldName()
Returns the name of the second field.- Returns:
- second field name
-
toString
public java.lang.String toString()
Produces a String, for debugging purposes.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a String representation
-
youAreType
public void youAreType(java.lang.Class<?> cls)
Allows a caller to suggest to this object that it holds a value of a certain type. This method should only be called on objects which report their type to be UnknownTypeValue. Otherwise, this method will throw and exception.- Specified by:
youAreType
in interfaceQueryEvaluable
- Parameters:
cls
- the Class of the type to be imposed on this object
-
getApproximateType
public int getApproximateType()
Returns an integer representing the approximate type of this QueryEvaluable, in the case where an accurate type cannot be ascertained.- Specified by:
getApproximateType
in interfaceQueryEvaluable
- Returns:
- an int, as described in UnknownTypeValue
-
equals
public boolean equals(java.lang.Object o)
Returns true if this is equal to the given object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
o
- the object- Returns:
- a boolean
-
hashCode
public int hashCode()
Returns a hash code for this object.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- an int
-
-