Class Constraint

  • All Implemented Interfaces:
    IConstraint

    public class Constraint
    extends java.lang.Object
    implements IConstraint
    • Method Detail

      • getSpecification

        public IConstraintSpecification getSpecification()
        Description copied from interface: IConstraint
        Returns the constraint specification from which the constraint was instantiated on the validation engine.
        Specified by:
        getSpecification in interface IConstraint
        Returns:
        The constraint specification.
      • getStoredViolations

        public java.util.Collection<IViolation> getStoredViolations()
        Description copied from interface: IConstraint
        Returns the violations stored by the constraint.

        Violations are stored if they have at least one listener registered.

        Specified by:
        getStoredViolations in interface IConstraint
        Returns:
        The Collection of stored Violations.
      • listViolations

        public java.util.Collection<IViolation> listViolations()
        Description copied from interface: IConstraint
        Returns the violations retrieved from the validation engine on demand.
        Specified by:
        listViolations in interface IConstraint
        Returns:
        The Collection of violations.
      • listViolations

        public java.util.Collection<IViolation> listViolations​(IViolationFilter filter)
        Description copied from interface: IConstraint
        Returns the violations retrieved from the validation engine on demand and filtered by the provided violation filter.
        Specified by:
        listViolations in interface IConstraint
        Parameters:
        filter - The violation filter instance to be used to filter the retrieved violations.
        Returns:
        The Collection of violations after applying the filter.
      • getListeners

        public java.util.Set<ConstraintListener> getListeners()
        Description copied from interface: IConstraint
        Returns the listeners registered for the constraint.
        Specified by:
        getListeners in interface IConstraint
        Returns:
        The Collection of listeners registered for the constraint.
      • addListener

        public boolean addListener​(ConstraintListener listener)
        Description copied from interface: IConstraint
        Adds the given listener to the list of listeners to be notified on specific events regarding the constraint.
        Specified by:
        addListener in interface IConstraint
        Parameters:
        listener - The listener to be registered.
      • addListener

        public boolean addListener​(ConstraintListener listener,
                                   IViolationFilter filter)
        Description copied from interface: IConstraint
        Adds the given listener to the list of listeners to be notified on specific events regarding the constraint.
        Specified by:
        addListener in interface IConstraint
        Parameters:
        listener - The listener to be registered.
        Returns:
        true if the listener was not registered before.
      • removeListener

        public boolean removeListener​(ConstraintListener listener)
        Description copied from interface: IConstraint
        Removes the given listener from the list of listeners to be notified on specific events regarding the constraint.
        Specified by:
        removeListener in interface IConstraint
        Parameters:
        listener - The listener to be deregistered.
        Returns:
        true if the listener was in fact registered.
      • notifyListenersViolationAppeared

        protected void notifyListenersViolationAppeared​(Violation violation)
      • notifyListenersViolationDisappeared

        protected void notifyListenersViolationDisappeared​(Violation violation)
      • getViolationKey

        protected ViolationKey getViolationKey​(java.util.Map<java.lang.String,​java.lang.Object> keyObjectMap)