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 boolean
addListener(ViolationListener listener)
Adds the given listener to the list of listeners to be notified on specific events regarding the violation.protected boolean
addMatch(IPatternMatch match)
Constraint
getConstraint()
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.String
getMessage()
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 void
notifyListenersViolationEntryAppeared(IPatternMatch match)
protected void
notifyListenersViolationEntryDisappeared(IPatternMatch match)
protected void
notifyListenersViolationMessageUpdated()
boolean
removeListener(ViolationListener listener)
Removes the given listener from the list of listeners to be notified on specific events regarding the violation.protected boolean
removeMatch(IPatternMatch match)
protected void
setConstraint(Constraint constraint)
protected void
setKeyObjects(java.util.Map<java.lang.String,java.lang.Object> keyObjects)
protected void
setMessage(java.lang.String message)
-
-
-
Method Detail
-
getConstraint
public Constraint getConstraint()
Description copied from interface:IViolation
Returns the constraint for which the violation appeared.- Specified by:
getConstraint
in interfaceIViolation
- Returns:
- The constraint.
-
setConstraint
protected void setConstraint(Constraint constraint)
-
getMessage
public java.lang.String getMessage()
Description copied from interface:IViolation
Returns the message of the violation generated from the format message of the constraint specification and the key objects.- Specified by:
getMessage
in 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:IViolation
Returns the key objects Map of the violation, which serves as a unique key of the violation.- Specified by:
getKeyObjects
in 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:IViolation
Returns the entries for each pattern match witch corresponds to the violation.- Specified by:
getEntries
in 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:IViolation
Returns all the values from the violation's entries for the given property.- Specified by:
getValuesOfProperty
in 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:IViolation
Returns the listeners registered for the violation.- Specified by:
getListeners
in interfaceIViolation
- Returns:
- The Collection of listeners registered for the violation.
-
addListener
public boolean addListener(ViolationListener listener)
Description copied from interface:IViolation
Adds the given listener to the list of listeners to be notified on specific events regarding the violation.- Specified by:
addListener
in interfaceIViolation
- Parameters:
listener
- The listener to be registered.
-
removeListener
public boolean removeListener(ViolationListener listener)
Description copied from interface:IViolation
Removes the given listener from the list of listeners to be notified on specific events regarding the violation.- Specified by:
removeListener
in interfaceIViolation
- Parameters:
listener
- The listener to be deregistered.- Returns:
true
if the listener was in fact registered.
-
notifyListenersViolationEntryAppeared
protected void notifyListenersViolationEntryAppeared(IPatternMatch match)
-
notifyListenersViolationMessageUpdated
protected void notifyListenersViolationMessageUpdated()
-
notifyListenersViolationEntryDisappeared
protected void notifyListenersViolationEntryDisappeared(IPatternMatch match)
-
-