@OpenApiAll public class DefaultValidationRuleImpl extends java.lang.Object implements ElementValidationRuleImpl, SmartListenerConfigurationProvider
Constructor and Description |
---|
DefaultValidationRuleImpl() |
Modifier and Type | Method and Description |
---|---|
protected Annotation |
createAnnotation(Element element,
Constraint constraint)
Default implementation creates an annotation without actions.
|
void |
dispose()
Cleans up used resources of the object.
|
protected java.util.Collection<? extends Element> |
getInvalidElements(Constraint constraint,
java.util.Collection<? extends Element> elements)
Returns invalid elements from the specified collection of elements.
|
java.util.Map<java.lang.Class<? extends Element>,java.util.Collection<SmartListenerConfig>> |
getListenerConfigurations()
Returns configurations for the rule's expression.
|
void |
init(Project project,
Constraint constraint)
Initializes the instance from specified parameters.
|
protected void |
initializeSingleRun()
Single run specific rule data can be initialized here.
|
java.util.Set<Annotation> |
run(Project project,
Constraint constraint,
java.util.Collection<? extends Element> elements)
Performs validation on the specified model elements by using specified constraint.
|
public void init(Project project, Constraint constraint)
init
in interface ElementValidationRuleImpl
project
- project on which model elements the validation rule applies.constraint
- a constraint object.@CheckForNull public java.util.Map<java.lang.Class<? extends Element>,java.util.Collection<SmartListenerConfig>> getListenerConfigurations()
getListenerConfigurations
in interface SmartListenerConfigurationProvider
@CheckForNull public final java.util.Set<Annotation> run(Project project, Constraint constraint, java.util.Collection<? extends Element> elements)
run
in interface ElementValidationRuleImpl
project
- a project of the constraint.constraint
- constraint that should be used to validate model elements.elements
- a collection of model elements that needs to be validated.Annotation
objects that describes violations of the rule.protected void initializeSingleRun()
protected Annotation createAnnotation(Element element, Constraint constraint)
Annotation
object with actions.element
- a model element for which Annotation
object should be created.constraint
- the constraint that is violated.Annotation
object.protected java.util.Collection<? extends Element> getInvalidElements(Constraint constraint, java.util.Collection<? extends Element> elements)
constraint
- constraint that specifies validation rules.elements
- a collection of elements that need to be validated.public void dispose()
dispose
in interface ElementValidationRuleImpl