java.lang.Object
org.refcodes.criteria.CriteriaSugar
public class CriteriaSugar extends Object
Declarative syntactic sugar which may be statically imported in order to
allow declarative definitions of
Criteria
trees: ... Criteria theCriteria = and( or( equalWith( "City", "Berlin" ),
equalWith( "City", "Munich" ) ), equalWith( "Surname", "Miller" ) ); ...- Version:
- $Id: $Id
- Author:
- steiner
-
Method Summary
Modifier and Type Method Description static AndCriteria
and(Criteria... aChildren)
Creates an ANDCriteriaNode
containing the providedCriteria
children.static <T> EqualWithCriteria<T>
equalWith(String aKey, T aValue)
Creates an EQUAL WITH ("=")CriteriaLeaf
expression relating to the given key and the given reference value.static <T> GreaterOrEqualThanCriteria<T>
greaterOrEqualThan(String aKey, T aValue)
Creates an GREATER OR EQUAL THAN (">=")CriteriaLeaf
expression relating to the given key and the given reference value.static <T> GreaterThanCriteria<T>
greaterThan(String aKey, T aValue)
Creates an GREATER THAN (">")CriteriaLeaf
expression relating to the given key and the given reference value.static IntersectWithCriteria
intersectWith(Criteria... aChildren)
Creates an INTERSECTCriteriaNode
containing the providedCriteria
children.static <T> LessOrEqualThanCriteria<T>
lessOrEqualThan(String aKey, T aValue)
Creates an LESS OR EQUAL THAN ("<=")CriteriaLeaf
expression relating to the given key and the given reference value.static <T> LessThanCriteria<T>
lessThan(String aKey, T aValue)
Creates an LESS THANCriteriaLeaf
expression relating to the given key and the given reference value.static NotCriteria
not(Criteria aCriteria)
Creates a NOTCriteriaNode
containing the providedCriteria
child.static <T> NotEqualWithCriteria<T>
notEqualWith(String aKey, T aValue)
Creates a NOT EQUAL WITH ("<>")CriteriaLeaf
expression relating to the given key and the given reference value.static OrCriteria
or(Criteria... aChildren)
Creates an ORCriteriaNode
containing the providedCriteria
children.
-
Method Details
-
and
Creates an ANDCriteriaNode
containing the providedCriteria
children.- Parameters:
aChildren
- TheCriteria
children to be contained in the ANDCriteriaNode
.- Returns:
- The AND
CriteriaNode
.
-
equalWith
Creates an EQUAL WITH ("=")CriteriaLeaf
expression relating to the given key and the given reference value.- Type Parameters:
T
- The type of theCriteriaLeaf
's value.- Parameters:
aKey
- The key on which the reference value is to be applied.aValue
- The reference value to be applied on the key.- Returns:
- The EQUAL WITH
CriteriaLeaf
.
-
greaterOrEqualThan
Creates an GREATER OR EQUAL THAN (">=")CriteriaLeaf
expression relating to the given key and the given reference value.- Type Parameters:
T
- The type of theCriteriaLeaf
's value.- Parameters:
aKey
- The key on which the reference value is to be applied.aValue
- The reference value to be applied on the key.- Returns:
- The GREATER OR EQUAL THAN
CriteriaLeaf
.
-
greaterThan
Creates an GREATER THAN (">")CriteriaLeaf
expression relating to the given key and the given reference value.- Type Parameters:
T
- The type of theCriteriaLeaf
's value.- Parameters:
aKey
- The key on which the reference value is to be applied.aValue
- The reference value to be applied on the key.- Returns:
- The GREATER THAN
CriteriaLeaf
.
-
intersectWith
Creates an INTERSECTCriteriaNode
containing the providedCriteria
children.- Parameters:
aChildren
- TheCriteria
children to be contained in the INTERSECTCriteriaNode
.- Returns:
- The INTERSECT
CriteriaNode
.
-
lessOrEqualThan
Creates an LESS OR EQUAL THAN ("<=")CriteriaLeaf
expression relating to the given key and the given reference value.- Type Parameters:
T
- The type of theCriteriaLeaf
's value.- Parameters:
aKey
- The key on which the reference value is to be applied.aValue
- The reference value to be applied on the key.- Returns:
- The LESS OR EQUAL THAN
CriteriaLeaf
.
-
lessThan
Creates an LESS THANCriteriaLeaf
expression relating to the given key and the given reference value.- Type Parameters:
T
- The type of theCriteriaLeaf
's value.- Parameters:
aKey
- The key on which the reference value is to be applied.aValue
- The reference value to be applied on the key.- Returns:
- The LESS THAN
CriteriaLeaf
.
-
not
Creates a NOTCriteriaNode
containing the providedCriteria
child.- Parameters:
aCriteria
- TheCriteria
child to be contained in the NOTCriteriaNode
.- Returns:
- The NOT
CriteriaNode
.
-
or
Creates an ORCriteriaNode
containing the providedCriteria
children.- Parameters:
aChildren
- TheCriteria
children to be contained in the ORCriteriaNode
.- Returns:
- The OR
CriteriaNode
.
-
notEqualWith
Creates a NOT EQUAL WITH ("<>")CriteriaLeaf
expression relating to the given key and the given reference value.- Type Parameters:
T
- The type of theCriteriaLeaf
's value.- Parameters:
aKey
- The key on which the reference value is to be applied.aValue
- The reference value to be applied on the key.- Returns:
- The NOT EQUAL WITH
CriteriaLeaf
.
-