org.teiid.connector.language
Class LanguageUtil

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

public final class LanguageUtil
extends java.lang.Object

Helpful utility methods to work with language interfaces.


Method Summary
static ICriteria combineCriteria(ICriteria primaryCrit, ICriteria additionalCrit, ILanguageFactory languageFactory)
          This utility method can be used to combine two criteria using an AND.
static java.util.List separateCriteriaByAnd(ICriteria 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 separateCriteriaByAnd(ICriteria 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 ICriteria combineCriteria(ICriteria primaryCrit,
                                        ICriteria additionalCrit,
                                        ILanguageFactory 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. If neither is null and the primaryCrit is an ICompoundCriteria, then the additionalCrit will be added to the primaryCrit and the primaryCrit will be returned. If the primaryCrit is not compound, a new ICompoundCriteria will be created and both criteria will be added to it.

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 © 2009. All Rights Reserved.