Package com.nomagic.magicdraw.validation
Interface ValidationRule
-
- All Known Implementing Classes:
DiagramValidator
,OpenedDiagramValidator
@OpenApiAll public interface ValidationRule
Defines interface for all validation rules. This interface should be implemented by classes that:
- Want to control whether validation should occur.
- Want to control what should be validated.
The implementing class must have a public no-arg constructor. If implementing class is designed for validating model elements then implementer of the class must honor project properties:- Validation scope
- Exclude elements from read-only modules
ElementValidationRuleImpl
interface.- See Also:
ElementValidationRuleImpl
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
dispose()
This method will be invoked when instance of theValidationRule
will become no longer needed.void
init(Project project, Constraint constraint)
This is the first method that is invoked on the implementation of theValidationRule
interface.boolean
needsRun()
Returns whether the validation rule needs to run.java.util.Set<Annotation>
run(Project project, Constraint constraint)
Run the validation.
-
-
-
Method Detail
-
init
void init(Project project, @CheckForNull Constraint constraint)
This is the first method that is invoked on the implementation of theValidationRule
interface. Implementation can initialize internal state if required.- Parameters:
project
- a project of the constraintconstraint
- a constraint object
-
needsRun
boolean needsRun()
Returns whether the validation rule needs to run.- Returns:
- true if validation rule needs to run, otherwise false
-
run
java.util.Set<Annotation> run(Project project, @CheckForNull Constraint constraint)
Run the validation.- Parameters:
project
- a project of the constraintconstraint
- a constraint object- Returns:
- set of
Annotation
objects
-
dispose
void dispose()
This method will be invoked when instance of theValidationRule
will become no longer needed.
-
-