Package com.nomagic.magicdraw.validation
Interface ElementValidationRuleImpl
- All Known Implementing Classes:
DefaultValidationRuleImpl
@OpenApiAll
public interface ElementValidationRuleImpl
Defines an interface for all validation rules which works with validation of model elements.
NOTE: Implementations of this interface MUST have a default no-arg constructor.
NOTE: Implementations of this interface MUST have a default no-arg constructor.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
dispose()
This method will be invoked when instance of theElementValidationRuleImpl
will become no longer needed.default void
init
(Project project, Constraint constraint) This is the first method that is invoked on the implementation of theElementValidationRuleImpl
interface.default void
postRun
(Project project, Constraint constraint) This method is invoked after run methoddefault void
preRun
(Project project, Constraint constraint) Deprecated.default void
preRun
(Project project, Constraint constraint, Collection<? extends Element> validatedElements) This method is invoked before run methodrun
(Project project, Constraint constraint, Collection<? extends Element> elements) Implementation of the method should perform validating of the specified model elements using specified constraint.
-
Method Details
-
init
This is the first method that is invoked on the implementation of theElementValidationRuleImpl
interface. Implementation can initialize internal state if required.- Parameters:
project
- a project of the constraint.constraint
- a constraint object.
-
preRun
Deprecated.This method is invoked before run method- Parameters:
project
- a project of the constraint.constraint
- a constraint object.
-
preRun
default void preRun(Project project, Constraint constraint, Collection<? extends Element> validatedElements) This method is invoked before run method- Parameters:
project
- a project of the constraint.constraint
- a constraint object.validatedElements
- elements to be sent for run
-
postRun
This method is invoked after run method- Parameters:
project
- a project of the constraint.constraint
- a constraint object.
-
run
Implementation of the method should perform validating of the specified model elements using specified constraint. The method returns a set ofAnnotation
objects that specifies information about invalid elements.- Parameters:
project
- a project of the constraint.constraint
- constraint which defines validation rules.elements
- collection of elements that have to be validated.- Returns:
- collection of
Annotation
objects that describes violations of the rule.
-
dispose
default void dispose()This method will be invoked when instance of theElementValidationRuleImpl
will become no longer needed.
-
preRun(com.nomagic.magicdraw.core.Project, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Constraint, java.util.Collection)