public class Constraint extends java.lang.Object implements IConstraint
Modifier and Type | Method and Description |
---|---|
boolean |
addListener(ConstraintListener listener)
Adds the given listener to the list of listeners to be notified on specific events regarding the constraint.
|
boolean |
addListener(ConstraintListener listener,
IViolationFilter filter)
Adds the given listener to the list of listeners to be notified on specific events regarding the constraint.
|
java.util.Set<ConstraintListener> |
getListeners()
Returns the listeners registered for the constraint.
|
IConstraintSpecification |
getSpecification()
Returns the constraint specification from which the constraint was instantiated on the validation engine.
|
java.util.Collection<IViolation> |
getStoredViolations()
Returns the violations stored by the constraint.
|
java.util.Collection<IViolation> |
listViolations()
Returns the violations retrieved from the validation engine on demand.
|
java.util.Collection<IViolation> |
listViolations(IViolationFilter filter)
Returns the violations retrieved from the validation engine on demand and filtered by the provided violation
filter.
|
boolean |
removeListener(ConstraintListener listener)
Removes the given listener from the list of listeners to be notified on specific events regarding the constraint.
|
public IConstraintSpecification getSpecification()
IConstraint
getSpecification
in interface IConstraint
public java.util.Collection<IViolation> getStoredViolations()
IConstraint
Violations are stored if they have at least one listener registered.
getStoredViolations
in interface IConstraint
public java.util.Collection<IViolation> listViolations()
IConstraint
listViolations
in interface IConstraint
public java.util.Collection<IViolation> listViolations(IViolationFilter filter)
IConstraint
listViolations
in interface IConstraint
filter
- The violation filter instance to be used to filter the retrieved violations.public java.util.Set<ConstraintListener> getListeners()
IConstraint
getListeners
in interface IConstraint
public boolean addListener(ConstraintListener listener)
IConstraint
addListener
in interface IConstraint
listener
- The listener to be registered.public boolean addListener(ConstraintListener listener, IViolationFilter filter)
IConstraint
addListener
in interface IConstraint
listener
- The listener to be registered.true
if the listener was not registered before.public boolean removeListener(ConstraintListener listener)
IConstraint
removeListener
in interface IConstraint
listener
- The listener to be deregistered.true
if the listener was in fact registered.