Package org.teiid.language
Class LanguageUtil
- java.lang.Object
-
- org.teiid.language.LanguageUtil
-
public final class LanguageUtil extends Object
Helpful utility methods to work with language interfaces.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Condition
combineCriteria(List<Condition> crits)
Combines a list of conditions under a single AndOrstatic Condition
combineCriteria(Condition primaryCrit, Condition additionalCrit, LanguageFactory languageFactory)
This utility method can be used to combine two criteria using an AND.static List<Condition>
separateCriteriaByAnd(Condition criteria)
Take a criteria, which may be null, a single IPredicateCriteria or a complex criteria built using ICompoundCriteria and breaks it apart at ANDs such that a List of ICriteria conjuncts are returned.
-
-
-
Method Detail
-
separateCriteriaByAnd
public static final List<Condition> separateCriteriaByAnd(Condition criteria)
Take a criteria, which may be null, a single IPredicateCriteria or a complex criteria built using ICompoundCriteria and breaks it apart at ANDs such that a List of ICriteria conjuncts are returned. For example, ((a=1 OR b=2) AND (c=3 AND d=4)) would return the list (a=1 OR b=2), c=3, d=4. If criteria is null, an empty list is returned.- Parameters:
criteria
- Criteria to break, may be null- Returns:
- List of ICriteria, never null
-
combineCriteria
public static Condition combineCriteria(Condition primaryCrit, Condition additionalCrit, LanguageFactory languageFactory)
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.- Parameters:
primaryCrit
- Primary criteria - may be modifiedadditionalCrit
- Won't be modified, but will likely be attached to the returned critlanguageFactory
- Will be used to construct new ICompoundCriteria if necessary- Returns:
- Combined criteria
-
-