public class Constraint extends java.lang.Object implements IConstraint
| Modifier | Constructor and Description |
|---|---|
protected |
Constraint(IConstraintSpecification specification,
ValidationEngine validationEngine,
org.apache.log4j.Logger logger) |
| 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.
|
protected void |
addViolation(ViolationKey key,
Violation violation) |
java.util.Set<ConstraintListener> |
getListeners()
Returns the listeners registered for the constraint.
|
protected RuleSpecification<IPatternMatch> |
getRuleSpecification() |
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.
|
protected ValidationEngine |
getValidationEngine() |
protected Violation |
getViolation(ViolationKey key) |
protected ViolationKey |
getViolationKey(IPatternMatch match) |
protected ViolationKey |
getViolationKey(java.util.Map<java.lang.String,java.lang.Object> keyObjectMap) |
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.
|
protected void |
notifyListenersViolationAppeared(Violation violation) |
protected void |
notifyListenersViolationDisappeared(Violation violation) |
boolean |
removeListener(ConstraintListener listener)
Removes the given listener from the list of listeners to be notified on specific events regarding the constraint.
|
protected Violation |
removeViolation(ViolationKey key) |
protected void |
setRuleSpecification(RuleSpecification<IPatternMatch> ruleSpecification) |
protected Constraint(IConstraintSpecification specification, ValidationEngine validationEngine, org.apache.log4j.Logger logger)
public IConstraintSpecification getSpecification()
IConstraintgetSpecification in interface IConstraintprotected ValidationEngine getValidationEngine()
protected RuleSpecification<IPatternMatch> getRuleSpecification()
protected void setRuleSpecification(RuleSpecification<IPatternMatch> ruleSpecification)
public java.util.Collection<IViolation> getStoredViolations()
IConstraintViolations are stored if they have at least one listener registered.
getStoredViolations in interface IConstraintprotected void addViolation(ViolationKey key, Violation violation)
protected Violation getViolation(ViolationKey key)
protected Violation removeViolation(ViolationKey key)
public java.util.Collection<IViolation> listViolations()
IConstraintlistViolations in interface IConstraintpublic java.util.Collection<IViolation> listViolations(IViolationFilter filter)
IConstraintlistViolations in interface IConstraintfilter - The violation filter instance to be used to filter the retrieved violations.public java.util.Set<ConstraintListener> getListeners()
IConstraintgetListeners in interface IConstraintpublic boolean addListener(ConstraintListener listener)
IConstraintaddListener in interface IConstraintlistener - The listener to be registered.public boolean addListener(ConstraintListener listener, IViolationFilter filter)
IConstraintaddListener in interface IConstraintlistener - The listener to be registered.true if the listener was not registered before.public boolean removeListener(ConstraintListener listener)
IConstraintremoveListener in interface IConstraintlistener - The listener to be deregistered.true if the listener was in fact registered.protected void notifyListenersViolationAppeared(Violation violation)
protected void notifyListenersViolationDisappeared(Violation violation)
protected ViolationKey getViolationKey(IPatternMatch match)
protected ViolationKey getViolationKey(java.util.Map<java.lang.String,java.lang.Object> keyObjectMap)