Class RegisteredConstraint

  • All Implemented Interfaces:
    Constraint

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

      • RegisteredConstraint

        public RegisteredConstraint()
    • Method Detail

      • getShortName

        public 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​(String shortName)
      • setRegisteredName

        public void setRegisteredName​(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 String getType()
        Defers to the registered constraint
        Specified by:
        getType in interface Constraint
        Returns:
        The type
      • getTitle

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

        public Map<String,​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​(Object value)
        Defers to the registered constraint
        Specified by:
        evaluate in interface Constraint
        Parameters:
        value - the property value to check