Package org.teiid.query.sql.lang
Class Criteria
- java.lang.Object
-
- org.teiid.query.sql.lang.Criteria
-
- All Implemented Interfaces:
Cloneable
,LanguageObject
,Expression
- Direct Known Subclasses:
ExpressionCriteria
,LogicalCriteria
,PredicateCriteria
,XMLExists
public abstract class Criteria extends Object implements Expression
This class represents the criteria clause for a query, which defines constraints on the data values to be retrieved for each parameter in the select clause.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.teiid.query.sql.LanguageObject
LanguageObject.Util
-
-
Constructor Summary
Constructors Constructor Description Criteria()
Constructs a default instance of this class.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Criteria
applyDemorgan(Criteria input)
abstract Object
clone()
Abstract clone methodstatic Criteria
combineCriteria(List<Criteria> parts)
static Criteria
combineCriteria(Criteria primaryCrit, Criteria additionalCrit)
This utility method can be used to combine two criteria using an AND.static Criteria
combineCriteria(Criteria primaryCrit, Criteria additionalCrit, boolean disjunctively)
Class<?>
getType()
Get the return type of this expression.static List<Criteria>
separateCriteriaByAnd(Criteria crit)
This utility method will pull apart a tree of criteria by breaking all compound AND criteria apart.String
toString()
Return the parser string.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.teiid.query.sql.LanguageObject
acceptVisitor
-
-
-
-
Method Detail
-
clone
public abstract Object clone()
Abstract clone method- Specified by:
clone
in interfaceLanguageObject
- Overrides:
clone
in classObject
- Returns:
- Deep clone of this criteria
-
separateCriteriaByAnd
public static List<Criteria> separateCriteriaByAnd(Criteria crit)
This utility method will pull apart a tree of criteria by breaking all compound AND criteria apart. For instance, ((A=1 AND B=2) AND C=3) will be broken into A=1, B=2, C=3.- Parameters:
crit
- Criteria to break apart- Returns:
- List of Criteria, empty list if crit is null
-
combineCriteria
public static Criteria combineCriteria(Criteria primaryCrit, Criteria additionalCrit)
This utility method can be used to combine two criteria using an AND. If both criteria are null, then null will be returned. If either is null, then the other will be returned. If neither is null and the primaryCrit is a CompoundCriteria, then the additionalCrit will be added to the primaryCrit and the primaryCrit will be returned. If the primaryCrit is not compound, a new CompoundCriteria will be created and both criteria will be added to it.- Parameters:
primaryCrit
- Primary criteria - may be modifiedadditionalCrit
- Won't be modified, but will likely be attached to the returned crit- Returns:
- Combined criteria
-
combineCriteria
public static Criteria combineCriteria(Criteria primaryCrit, Criteria additionalCrit, boolean disjunctively)
-
getType
public Class<?> getType()
Description copied from interface:Expression
Get the return type of this expression.- Specified by:
getType
in interfaceExpression
- Returns:
- Java class may be null prior to being resolved
-
-