Class Violation
- java.lang.Object
-
- org.eclipse.viatra.addon.validation.core.Violation
-
- All Implemented Interfaces:
IViolation
public class Violation extends java.lang.Object implements IViolation
-
-
Constructor Summary
Constructors Constructor Description Violation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddListener(ViolationListener listener)Adds the given listener to the list of listeners to be notified on specific events regarding the violation.protected booleanaddMatch(IPatternMatch match)ConstraintgetConstraint()Returns the constraint for which the violation appeared.java.util.Set<IEntry>getEntries()Returns the entries for each pattern match witch corresponds to the violation.java.util.Map<java.lang.String,java.lang.Object>getKeyObjects()Returns the key objects Map of the violation, which serves as a unique key of the violation.java.util.Set<ViolationListener>getListeners()Returns the listeners registered for the violation.protected java.util.Map<ViolationKey,IPatternMatch>getMatches()java.lang.StringgetMessage()Returns the message of the violation generated from the format message of the constraint specification and the key objects.java.util.Set<java.lang.Object>getValuesOfProperty(java.lang.String propertyName)Returns all the values from the violation's entries for the given property.protected voidnotifyListenersViolationEntryAppeared(IPatternMatch match)protected voidnotifyListenersViolationEntryDisappeared(IPatternMatch match)protected voidnotifyListenersViolationMessageUpdated()booleanremoveListener(ViolationListener listener)Removes the given listener from the list of listeners to be notified on specific events regarding the violation.protected booleanremoveMatch(IPatternMatch match)protected voidsetConstraint(Constraint constraint)protected voidsetKeyObjects(java.util.Map<java.lang.String,java.lang.Object> keyObjects)protected voidsetMessage(java.lang.String message)
-
-
-
Method Detail
-
getConstraint
public Constraint getConstraint()
Description copied from interface:IViolationReturns the constraint for which the violation appeared.- Specified by:
getConstraintin interfaceIViolation- Returns:
- The constraint.
-
setConstraint
protected void setConstraint(Constraint constraint)
-
getMessage
public java.lang.String getMessage()
Description copied from interface:IViolationReturns the message of the violation generated from the format message of the constraint specification and the key objects.- Specified by:
getMessagein interfaceIViolation- Returns:
- The message.
-
setMessage
protected void setMessage(java.lang.String message)
-
getKeyObjects
public java.util.Map<java.lang.String,java.lang.Object> getKeyObjects()
Description copied from interface:IViolationReturns the key objects Map of the violation, which serves as a unique key of the violation.- Specified by:
getKeyObjectsin interfaceIViolation- Returns:
- The key objects Map, containing the parameters names and values as key value pairs.
-
setKeyObjects
protected void setKeyObjects(java.util.Map<java.lang.String,java.lang.Object> keyObjects)
-
getMatches
protected java.util.Map<ViolationKey,IPatternMatch> getMatches()
-
addMatch
protected boolean addMatch(IPatternMatch match)
-
removeMatch
protected boolean removeMatch(IPatternMatch match)
-
getEntries
public java.util.Set<IEntry> getEntries()
Description copied from interface:IViolationReturns the entries for each pattern match witch corresponds to the violation.- Specified by:
getEntriesin interfaceIViolation- Returns:
- The Set of entries, each representing a pattern match for the violation.
-
getValuesOfProperty
public java.util.Set<java.lang.Object> getValuesOfProperty(java.lang.String propertyName)
Description copied from interface:IViolationReturns all the values from the violation's entries for the given property.- Specified by:
getValuesOfPropertyin interfaceIViolation- Parameters:
propertyName- The property's name for which the values should be returned.- Returns:
- The Set of values for the requested property.
-
getListeners
public java.util.Set<ViolationListener> getListeners()
Description copied from interface:IViolationReturns the listeners registered for the violation.- Specified by:
getListenersin interfaceIViolation- Returns:
- The Collection of listeners registered for the violation.
-
addListener
public boolean addListener(ViolationListener listener)
Description copied from interface:IViolationAdds the given listener to the list of listeners to be notified on specific events regarding the violation.- Specified by:
addListenerin interfaceIViolation- Parameters:
listener- The listener to be registered.
-
removeListener
public boolean removeListener(ViolationListener listener)
Description copied from interface:IViolationRemoves the given listener from the list of listeners to be notified on specific events regarding the violation.- Specified by:
removeListenerin interfaceIViolation- Parameters:
listener- The listener to be deregistered.- Returns:
trueif the listener was in fact registered.
-
notifyListenersViolationEntryAppeared
protected void notifyListenersViolationEntryAppeared(IPatternMatch match)
-
notifyListenersViolationMessageUpdated
protected void notifyListenersViolationMessageUpdated()
-
notifyListenersViolationEntryDisappeared
protected void notifyListenersViolationEntryDisappeared(IPatternMatch match)
-
-