public interface IConstraint
We differentiate between Constraint Specification that represents the validation rule and Constraint that represents the instantiation of a constraint specification on a validation engine.
Each constraint stores:
It provides capabilities for:
For constraints specified by VIATRA Query patterns, the matcher is stored.
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.Collection<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.
|
java.util.Collection<IViolation> listViolations()
java.util.Collection<IViolation> listViolations(IViolationFilter filter)
filter
- The violation filter instance to be used to filter the retrieved violations.java.util.Collection<IViolation> getStoredViolations()
Violations are stored if they have at least one listener registered.
IConstraintSpecification getSpecification()
java.util.Collection<ConstraintListener> getListeners()
boolean addListener(ConstraintListener listener)
listener
- The listener to be registered.boolean addListener(ConstraintListener listener, IViolationFilter filter)
listener
- The listener to be registered.filter
- true
if the listener was not registered before.boolean removeListener(ConstraintListener listener)
listener
- The listener to be deregistered.true
if the listener was in fact registered.