org.oreodata.predicates
Class Predicates

java.lang.Object
  |
  +--org.oreodata.predicates.Predicates

public class Predicates
extends java.lang.Object

Holder for factory methods for predicate objects.

See Also:
RecordFilter

Field Summary
static Predicate IS_CHILD_PREDICATE
           
static Predicate IS_ROOT_PREDICATE
           
static RecordFilter NULL_FILTER
          A trivial RecordFilter that simply accepts anything.
 
Constructor Summary
Predicates()
           
 
Method Summary
static Predicate getEqualityPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue)
          this is equivalent to getEqualityPredicate(recType, fieldName, comparisonValue, false)
static Predicate getEqualityPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, boolean caseInsensitive)
           
static Predicate getGreaterThanEqualsPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue)
           
static Predicate getGreaterThanEqualsPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, java.util.Comparator comparator)
           
static Predicate getGreaterThanPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue)
           
static Predicate getGreaterThanPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, java.util.Comparator comparator)
           
static Predicate getInequalityPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue)
          this is equivalent to getInequalityPredicate(recType, fieldName, comparisonValue, false)
static Predicate getInequalityPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, boolean caseInsensitive)
           
static Predicate getIntersection(Predicate lhs, Predicate rhs)
           
static Predicate getLessThanEqualsPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue)
           
static Predicate getLessThanEqualsPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, java.util.Comparator comparator)
           
static Predicate getLessThanPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue)
           
static Predicate getLessThanPredicate(java.lang.String recType, java.lang.String fieldName, java.lang.Object comparisonValue, java.util.Comparator comparator)
           
static Predicate getLikePredicate(java.lang.String recType, java.lang.String fieldName, java.lang.String comparisonValue, boolean caseInsensitive)
           
static Predicate getNotLikePredicate(java.lang.String recType, java.lang.String fieldName, java.lang.String comparisonValue, boolean caseInsensitive)
           
static Predicate getUnion(Predicate lhs, Predicate rhs)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_FILTER

public static final RecordFilter NULL_FILTER
A trivial RecordFilter that simply accepts anything.


IS_ROOT_PREDICATE

public static final Predicate IS_ROOT_PREDICATE

IS_CHILD_PREDICATE

public static final Predicate IS_CHILD_PREDICATE
Constructor Detail

Predicates

public Predicates()
Method Detail

getEqualityPredicate

public static Predicate getEqualityPredicate(java.lang.String recType,
                                             java.lang.String fieldName,
                                             java.lang.Object comparisonValue)
this is equivalent to getEqualityPredicate(recType, fieldName, comparisonValue, false)


getEqualityPredicate

public static Predicate getEqualityPredicate(java.lang.String recType,
                                             java.lang.String fieldName,
                                             java.lang.Object comparisonValue,
                                             boolean caseInsensitive)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
caseInsensitive - whether to perform a case-insensitive match
Returns:
A predicate that represents all records of a given type whose given field has the given a value.
If caseInsensitive is true, the comparisonValue must be a string (of course!)

getInequalityPredicate

public static Predicate getInequalityPredicate(java.lang.String recType,
                                               java.lang.String fieldName,
                                               java.lang.Object comparisonValue,
                                               boolean caseInsensitive)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
caseInsensitive - whether to do a case-insensitive match.
Returns:
A predicate that represents all records of a given type whose given field is not of the given value.
If caseInsensitive is true, the comparisonValue must be a string (of course!)

getInequalityPredicate

public static Predicate getInequalityPredicate(java.lang.String recType,
                                               java.lang.String fieldName,
                                               java.lang.Object comparisonValue)
this is equivalent to getInequalityPredicate(recType, fieldName, comparisonValue, false)


getLessThanPredicate

public static Predicate getLessThanPredicate(java.lang.String recType,
                                             java.lang.String fieldName,
                                             java.lang.Object comparisonValue)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
Returns:
A predicate that represents all records of a given type whose given field is less than the given value.

getLessThanPredicate

public static Predicate getLessThanPredicate(java.lang.String recType,
                                             java.lang.String fieldName,
                                             java.lang.Object comparisonValue,
                                             java.util.Comparator comparator)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
comparator - A custom comparator to use for comparisons
Returns:
A predicate that represents all records of a given type whose given field is less than the given value.

getGreaterThanPredicate

public static Predicate getGreaterThanPredicate(java.lang.String recType,
                                                java.lang.String fieldName,
                                                java.lang.Object comparisonValue)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
Returns:
A predicate that represents all records of a given type whose given field is greater than the given value.

getGreaterThanPredicate

public static Predicate getGreaterThanPredicate(java.lang.String recType,
                                                java.lang.String fieldName,
                                                java.lang.Object comparisonValue,
                                                java.util.Comparator comparator)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
comparator - A custom comparator to use for comparisons
Returns:
A predicate that represents all records of a given type whose given field is greater than the given value.

getLessThanEqualsPredicate

public static Predicate getLessThanEqualsPredicate(java.lang.String recType,
                                                   java.lang.String fieldName,
                                                   java.lang.Object comparisonValue)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
Returns:
A predicate that represents all records of a given type whose given field is less than or equal to the given value.

getLessThanEqualsPredicate

public static Predicate getLessThanEqualsPredicate(java.lang.String recType,
                                                   java.lang.String fieldName,
                                                   java.lang.Object comparisonValue,
                                                   java.util.Comparator comparator)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
comparator - A custom comparator to use for comparisons
Returns:
A predicate that represents all records of a given type whose given field is less than or equal to the given value.

getGreaterThanEqualsPredicate

public static Predicate getGreaterThanEqualsPredicate(java.lang.String recType,
                                                      java.lang.String fieldName,
                                                      java.lang.Object comparisonValue)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
Returns:
A predicate that represents all records of a given type whose given field is greater than or equal to the given value.

getGreaterThanEqualsPredicate

public static Predicate getGreaterThanEqualsPredicate(java.lang.String recType,
                                                      java.lang.String fieldName,
                                                      java.lang.Object comparisonValue,
                                                      java.util.Comparator comparator)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The value to compare that field's value with.
comparator - A custom comparator to use for comparisons
Returns:
A predicate that represents all records of a given type whose given field is greater than or equal to the given value.

getLikePredicate

public static Predicate getLikePredicate(java.lang.String recType,
                                         java.lang.String fieldName,
                                         java.lang.String comparisonValue,
                                         boolean caseInsensitive)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The string to compare with
caseInsensitive - whether to do a case-insensitive match.
Returns:
A predicate that represents all records of a given type whose given field is greater than or equal to the given value.

getNotLikePredicate

public static Predicate getNotLikePredicate(java.lang.String recType,
                                            java.lang.String fieldName,
                                            java.lang.String comparisonValue,
                                            boolean caseInsensitive)
Parameters:
recType - The type of record we are interested in.
fieldName - The name of the field of the record we are filtering on.
comparisonValue - The string to compare with
caseInsensitive - whether to do a case-insensitive match.
Returns:
A predicate that represents all records of a given type whose given field is greater than or equal to the given value.

getIntersection

public static Predicate getIntersection(Predicate lhs,
                                        Predicate rhs)
Parameters:
lhs - left-hand side
rhs - right-hand side
Returns:
A predicate that represents the intersection of the two conditions. A logical AND

getUnion

public static Predicate getUnion(Predicate lhs,
                                 Predicate rhs)
Parameters:
lhs - left-hand side
rhs - right-hand side
Returns:
A predicate that represents the union of the two conditions. A logical OR