Class Constraints


  • public final class Constraints
    extends java.lang.Object
    Builds constraints for the PathQuery.
    Author:
    Matthew Wakeling
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static PathConstraintAttribute contains​(java.lang.String path, java.lang.String contained)
      Creates a constraint for a path to contain a value.
      static PathConstraintAttribute doesNotContain​(java.lang.String path, java.lang.String contained)
      Creates a constraint for a path to not contain a value.
      static PathConstraintAttribute eq​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be equal to a value.
      static PathConstraintAttribute equalsExactly​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be exactly equal to a value.
      static PathConstraintLoop equalToLoop​(java.lang.String path, java.lang.String loopPath)
      Creates a constraint for a path to be equal to a loopPath.
      static PathConstraintAttribute greaterThan​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be greater than a value.
      static PathConstraintAttribute greaterThanEqualTo​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be greater than or equal to a value.
      static PathConstraintBag in​(java.lang.String path, java.lang.String bag)
      Creates a constraint for a path to be IN a named bag.
      static PathConstraintIds inIds​(java.lang.String path, java.util.Collection<java.lang.Integer> ids)
      Creates a constraint for a path to be IN a collection of ids.
      static PathConstraintNull isNotNull​(java.lang.String path)
      Creates a constraint for a path to be not null.
      static PathConstraintNull isNull​(java.lang.String path)
      Creates a constraint for a path to be null.
      static PathConstraintAttribute lessThan​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be less than a value.
      static PathConstraintAttribute lessThanEqualTo​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be less than or equal to a value.
      static PathConstraintAttribute like​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be LIKE a value.
      static PathConstraintLookup lookup​(java.lang.String path, java.lang.String value, java.lang.String extraValue)
      Creates a constraint for a path with the LOOKUP operator.
      static PathConstraintAttribute neq​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be not equal to a value.
      static PathConstraintMultiValue noneOfValues​(java.lang.String path, java.util.Collection<java.lang.String> values)
      Creates a constraint for a path to be NOT ONE OF a collection of values.
      static PathConstraintLoop notEqualToLoop​(java.lang.String path, java.lang.String loopPath)
      Creates a constraint for a path to be not equal to a loopPath.
      static PathConstraintBag notIn​(java.lang.String path, java.lang.String bag)
      Creates a constraint for a path to be NOT IN a named bag.
      static PathConstraintIds notInIds​(java.lang.String path, java.util.Collection<java.lang.Integer> ids)
      Creates a constraint for a path to be NOT IN a collection of ids.
      static PathConstraintAttribute notLike​(java.lang.String path, java.lang.String value)
      Creates a constraint for a path to be NOT LIKE a value.
      static PathConstraintMultiValue oneOfValues​(java.lang.String path, java.util.Collection<java.lang.String> values)
      Creates a constraint for a path to be ONE OF a collection of values.
      static PathConstraintSubclass type​(java.lang.String path, java.lang.String type)
      Creates a constraint for a path to be a particular subclass (type).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • eq

        public static PathConstraintAttribute eq​(java.lang.String path,
                                                 java.lang.String value)
        Creates a constraint for a path to be equal to a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • equalsExactly

        public static PathConstraintAttribute equalsExactly​(java.lang.String path,
                                                            java.lang.String value)
        Creates a constraint for a path to be exactly equal to a value. This does not provide any benefit for numbers, but strings are always lower-cased for equality comparison - this operator means that the user wants to perform strict equals comparison.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • neq

        public static PathConstraintAttribute neq​(java.lang.String path,
                                                  java.lang.String value)
        Creates a constraint for a path to be not equal to a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • like

        public static PathConstraintAttribute like​(java.lang.String path,
                                                   java.lang.String value)
        Creates a constraint for a path to be LIKE a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • notLike

        public static PathConstraintAttribute notLike​(java.lang.String path,
                                                      java.lang.String value)
        Creates a constraint for a path to be NOT LIKE a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • lessThan

        public static PathConstraintAttribute lessThan​(java.lang.String path,
                                                       java.lang.String value)
        Creates a constraint for a path to be less than a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • lessThanEqualTo

        public static PathConstraintAttribute lessThanEqualTo​(java.lang.String path,
                                                              java.lang.String value)
        Creates a constraint for a path to be less than or equal to a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • greaterThan

        public static PathConstraintAttribute greaterThan​(java.lang.String path,
                                                          java.lang.String value)
        Creates a constraint for a path to be greater than a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • greaterThanEqualTo

        public static PathConstraintAttribute greaterThanEqualTo​(java.lang.String path,
                                                                 java.lang.String value)
        Creates a constraint for a path to be greater than or equal to a value.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        Returns:
        a new PathConstraint object
      • lookup

        public static PathConstraintLookup lookup​(java.lang.String path,
                                                  java.lang.String value,
                                                  java.lang.String extraValue)
        Creates a constraint for a path with the LOOKUP operator.
        Parameters:
        path - the path to apply the constraint to
        value - the value to constrain to
        extraValue - the extra value
        Returns:
        a new PathConstraint object
      • in

        public static PathConstraintBag in​(java.lang.String path,
                                           java.lang.String bag)
        Creates a constraint for a path to be IN a named bag.
        Parameters:
        path - the path to apply the constraint to
        bag - the bag name to constrain to
        Returns:
        a new PathConstraint object
      • notIn

        public static PathConstraintBag notIn​(java.lang.String path,
                                              java.lang.String bag)
        Creates a constraint for a path to be NOT IN a named bag.
        Parameters:
        path - the path to apply the constraint to
        bag - the bag name to constrain to
        Returns:
        a new PathConstraint object
      • inIds

        public static PathConstraintIds inIds​(java.lang.String path,
                                              java.util.Collection<java.lang.Integer> ids)
        Creates a constraint for a path to be IN a collection of ids.
        Parameters:
        path - the path to apply the constraint to
        ids - the Collection of ids to constrain to
        Returns:
        a new PathConstraint object
      • notInIds

        public static PathConstraintIds notInIds​(java.lang.String path,
                                                 java.util.Collection<java.lang.Integer> ids)
        Creates a constraint for a path to be NOT IN a collection of ids.
        Parameters:
        path - the path to apply the constraint to
        ids - the Collection of ids to constrain to
        Returns:
        a new PathConstraint object
      • oneOfValues

        public static PathConstraintMultiValue oneOfValues​(java.lang.String path,
                                                           java.util.Collection<java.lang.String> values)
        Creates a constraint for a path to be ONE OF a collection of values.
        Parameters:
        path - the path to apply the constraint to
        values - the Collection of values to constrain to
        Returns:
        a new PathConstraint object
      • noneOfValues

        public static PathConstraintMultiValue noneOfValues​(java.lang.String path,
                                                            java.util.Collection<java.lang.String> values)
        Creates a constraint for a path to be NOT ONE OF a collection of values.
        Parameters:
        path - the path to apply the constraint to
        values - the Collection of values to constrain to
        Returns:
        a new PathConstraint object
      • isNull

        public static PathConstraintNull isNull​(java.lang.String path)
        Creates a constraint for a path to be null.
        Parameters:
        path - the path to apply the constraint to
        Returns:
        a new PathConstraint object
      • isNotNull

        public static PathConstraintNull isNotNull​(java.lang.String path)
        Creates a constraint for a path to be not null.
        Parameters:
        path - the path to apply the constraint to
        Returns:
        a new PathConstraint object
      • type

        public static PathConstraintSubclass type​(java.lang.String path,
                                                  java.lang.String type)
        Creates a constraint for a path to be a particular subclass (type). The type should be an unqualified class name that is a valid subclass of the end element of the path.
        Parameters:
        path - the path to apply the constraint to
        type - an unqualified class name of the subclass
        Returns:
        a new PathConstraint object
      • equalToLoop

        public static PathConstraintLoop equalToLoop​(java.lang.String path,
                                                     java.lang.String loopPath)
        Creates a constraint for a path to be equal to a loopPath.
        Parameters:
        path - the path that the constraint is attached to
        loopPath - the path that the constraint is looped onto
        Returns:
        a new PathConstraint object
      • notEqualToLoop

        public static PathConstraintLoop notEqualToLoop​(java.lang.String path,
                                                        java.lang.String loopPath)
        Creates a constraint for a path to be not equal to a loopPath.
        Parameters:
        path - the path that the constraint is attached to
        loopPath - the path that the constraint is looped onto
        Returns:
        a new PathConstraint object
      • contains

        public static PathConstraintAttribute contains​(java.lang.String path,
                                                       java.lang.String contained)
        Creates a constraint for a path to contain a value.
        Parameters:
        path - the path that the constraint is attached to
        contained - the value this path's field should contain.
        Returns:
        a new PathConstraint object
      • doesNotContain

        public static PathConstraintAttribute doesNotContain​(java.lang.String path,
                                                             java.lang.String contained)
        Creates a constraint for a path to not contain a value.
        Parameters:
        path - the path that the constraint is attached to
        contained - the value this path's field should not contain.
        Returns:
        a new PathConstraint object