Class RangeConstraint

java.lang.Object
com.highdeal.udr.hci.ConstraintObject
com.highdeal.udr.hci.RangeConstraint

public class RangeConstraint extends ConstraintObject
The RangeConstraint implements the constraint defined by a range min and a range max. Integer, long, big decimal, big integer and date entities can be constrained by a range constraint.

The standard way to create a RangeConstraint instance is to use the method ConstraintObject.createConstraintFromString(String) with a string representation of a range constraint.

  • Field Details

    • TYPE_INCLUSIVE

      public static final int TYPE_INCLUSIVE
      the inclusive type for range constraint.
      See Also:
    • TYPE_EXCLUSIVE

      public static final int TYPE_EXCLUSIVE
      the exclusive type for range constraint.
      See Also:
  • Constructor Details

    • RangeConstraint

      public RangeConstraint()
      Builds a range constraint.
    • RangeConstraint

      public RangeConstraint(Object rangeMin, int rangeMinType, Object rangeMax, int rangeMaxType)
      Build a range constraint with minimum and maximum values plus their type (TYPE_INCLUSIVE, TYPE_EXCLUSIVE)
      Parameters:
      rangeMin - the minimum range value
      rangeMinType - the type of minimum range value (TYPE_INCLUSIVE, TYPE_EXCLUSIVE)
      rangeMax - the maximum range value
      rangeMaxType - the type of maximum range value (TYPE_INCLUSIVE, TYPE_EXCLUSIVE)
  • Method Details

    • getInitializationString

      public String getInitializationString()
      Returns the initialization string.
      Specified by:
      getInitializationString in class ConstraintObject
      Returns:
      the initialization string.
    • setInitializationString

      public void setInitializationString(String initializationString)
      Sets the initialization string.
      Parameters:
      initializationString - the initialization string.
    • getRangeMin

      public Object getRangeMin()
      Returns the range min of range constraint.
      Returns:
      the range min.
    • setRangeMin

      public void setRangeMin(Object rangeMin)
      Sets the range min of range constraint.
      Parameters:
      rangeMin - the range Min.
    • getRangeMinType

      public int getRangeMinType()
      Returns the range min type of range constraint.
      Returns:
      the range min type.
      See Also:
    • setRangeMinType

      public void setRangeMinType(int rangeMinType)
      Sets the range min type of range constraint.

      A range min specifies a range type . The allowed types are :

      Parameters:
      rangeMinType - the range min type.
    • getRangeMax

      public Object getRangeMax()
      Returns the range max of range constraint.
      Returns:
      the range max.
    • setRangeMax

      public void setRangeMax(Object rangeMax)
      Sets the range max of range constraint.
      Parameters:
      rangeMax - the range Max.
    • getRangeMaxType

      public int getRangeMaxType()
      Returns the range max type of range constraint.
      Returns:
      the range max type.
      See Also:
    • setRangeMaxType

      public void setRangeMaxType(int rangeMaxType)
      Sets the range max type of range constraint.

      A range max specifies a range type . The allowed types are :

      Parameters:
      rangeMaxType - the range max type.
    • isValidValue

      public boolean isValidValue(Object value)
      Tests if the value checks the range constraint.
      Specified by:
      isValidValue in class ConstraintObject
      Parameters:
      value - the value to check
      Returns:
      true if the value checks the range constraint. false otherwise.
    • toString

      public String toString()
      Returns string representationthat represents the range constraint.
      Specified by:
      toString in class ConstraintObject
      Returns:
      the string representation.
    • isIntegerConstraint

      public boolean isIntegerConstraint()
      Returns integer status of the range constraint.
      Specified by:
      isIntegerConstraint in class ConstraintObject
      Returns:
      true if the range limits are integers or null, false otherwise.
    • isLongConstraint

      public boolean isLongConstraint()
      Returns long status of the range constraint.
      Specified by:
      isLongConstraint in class ConstraintObject
      Returns:
      true if the range limits are longs or null, false otherwise.
    • isBigIntegerConstraint

      public boolean isBigIntegerConstraint()
      Returns big integer status of the range constraint.
      Specified by:
      isBigIntegerConstraint in class ConstraintObject
      Returns:
      true if the range limits are big integers or null, false otherwise.
    • isDecimalConstraint

      public boolean isDecimalConstraint()
      Returns decimal status of the range constraint.
      Specified by:
      isDecimalConstraint in class ConstraintObject
      Returns:
      true if the range limits are big decimals or null, false otherwise.
    • isDateConstraint

      public boolean isDateConstraint()
      Returns date status of the range constraint.
      Specified by:
      isDateConstraint in class ConstraintObject
      Returns:
      true if the range limits are dates or null, false otherwise.
    • isStringConstraint

      public boolean isStringConstraint()
      Returns string status of the range constraint.
      Specified by:
      isStringConstraint in class ConstraintObject
      Returns:
      false in any case.
    • isBooleanConstraint

      public boolean isBooleanConstraint()
      Returns boolean status of the range constraint.
      Specified by:
      isBooleanConstraint in class ConstraintObject
      Returns:
      false in any case.