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:
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:
- 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:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.run
(Project project, Constraint constraint) Run the validation.
-
Method Details
-
init
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
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.
-