Class RegisteredConstraint

  • All Implemented Interfaces:
    Constraint

    public final class RegisteredConstraint
    extends java.lang.Object
    implements Constraint
    Constraint implementation that defers to constraints registered with the static instance of the ConstraintRegistry.
    Author:
    Derek Hulley
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void evaluate​(java.lang.Object value)
      Defers to the registered constraint
      java.util.Map<java.lang.String,​java.lang.Object> getParameters()
      Defers to the registered constraint
      Constraint getRegisteredConstraint()  
      java.lang.String getShortName()
      Gets the constraint name.
      java.lang.String getTitle()
      Defers to the registered constraint
      java.lang.String getType()
      Defers to the registered constraint
      void initialize()
      Initializes the constraint with appropriate values, which will depend on the implementation itself.
      void setRegisteredName​(java.lang.String registeredName)
      Set the name of the constraint that will be used to look up the constraint that will be delegated to.
      void setShortName​(java.lang.String shortName)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • RegisteredConstraint

        public RegisteredConstraint()
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getShortName

        public java.lang.String getShortName()
        Description copied from interface: Constraint
        Gets the constraint name.
        Specified by:
        getShortName in interface Constraint
        Returns:
        the constraint name.
      • setShortName

        public void setShortName​(java.lang.String shortName)
      • setRegisteredName

        public void setRegisteredName​(java.lang.String registeredName)
        Set the name of the constraint that will be used to look up the constraint that will be delegated to.
      • initialize

        public void initialize()
        Description copied from interface: Constraint
        Initializes the constraint with appropriate values, which will depend on the implementation itself. This method can be implemented as a once-off, i.e. reinitialization does not have to be supported.
        Specified by:
        initialize in interface Constraint
      • getRegisteredConstraint

        public Constraint getRegisteredConstraint()
        Returns:
        the constraint that matches the registered name
      • getType

        public java.lang.String getType()
        Defers to the registered constraint
        Specified by:
        getType in interface Constraint
        Returns:
        The type
      • getTitle

        public java.lang.String getTitle()
        Defers to the registered constraint
        Specified by:
        getTitle in interface Constraint
        Returns:
        the human-readable constraint title (optional)
      • getParameters

        public java.util.Map<java.lang.String,​java.lang.Object> getParameters()
        Defers to the registered constraint
        Specified by:
        getParameters in interface Constraint
        Returns:
        Map of parameters or an empty Map if none exist
      • evaluate

        public void evaluate​(java.lang.Object value)
        Defers to the registered constraint
        Specified by:
        evaluate in interface Constraint
        Parameters:
        value - the property value to check