org.teiid.language
Class LanguageUtil

java.lang.Object
  extended by org.teiid.language.LanguageUtil

public final class LanguageUtil
extends java.lang.Object

Helpful utility methods to work with language interfaces.


Method Summary
static Condition combineCriteria(Condition primaryCrit, Condition additionalCrit, LanguageFactory languageFactory)
          This utility method can be used to combine two criteria using an AND.
static java.util.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

separateCriteriaByAnd

public static final java.util.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 modified
additionalCrit - Won't be modified, but will likely be attached to the returned crit
languageFactory - Will be used to construct new ICompoundCriteria if necessary
Returns:
Combined criteria


Copyright © 2011. All Rights Reserved.