Class CriteriaSugar

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 Details

    • and

      public static AndCriteria and​(Criteria... aChildren)
      Creates an AND CriteriaNode containing the provided Criteria children.
      Parameters:
      aChildren - The Criteria children to be contained in the AND CriteriaNode.
      Returns:
      The AND CriteriaNode.
    • equalWith

      public 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.
      Type Parameters:
      T - The type of the CriteriaLeaf'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

      public 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.
      Type Parameters:
      T - The type of the CriteriaLeaf'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

      public 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.
      Type Parameters:
      T - The type of the CriteriaLeaf'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

      public static IntersectWithCriteria intersectWith​(Criteria... aChildren)
      Creates an INTERSECT CriteriaNode containing the provided Criteria children.
      Parameters:
      aChildren - The Criteria children to be contained in the INTERSECT CriteriaNode.
      Returns:
      The INTERSECT CriteriaNode.
    • lessOrEqualThan

      public 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.
      Type Parameters:
      T - The type of the CriteriaLeaf'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

      public static <T> LessThanCriteria<T> lessThan​(String aKey, T aValue)
      Creates an LESS THAN CriteriaLeaf expression relating to the given key and the given reference value.
      Type Parameters:
      T - The type of the CriteriaLeaf'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

      public static NotCriteria not​(Criteria aCriteria)
      Creates a NOT CriteriaNode containing the provided Criteria child.
      Parameters:
      aCriteria - The Criteria child to be contained in the NOT CriteriaNode.
      Returns:
      The NOT CriteriaNode.
    • or

      public static OrCriteria or​(Criteria... aChildren)
      Creates an OR CriteriaNode containing the provided Criteria children.
      Parameters:
      aChildren - The Criteria children to be contained in the OR CriteriaNode.
      Returns:
      The OR CriteriaNode.
    • notEqualWith

      public 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.
      Type Parameters:
      T - The type of the CriteriaLeaf'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.