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.
    • Method Detail

      • init

        default void init​(Project project,
                          Constraint constraint)
        This is the first method that is invoked on the implementation of the ElementValidationRuleImpl interface. Implementation can initialize internal state if required.
        Parameters:
        project - a project of the constraint.
        constraint - a constraint object.
      • preRun

        default void preRun​(Project project,
                            Constraint constraint,
                            java.util.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

        default void postRun​(Project project,
                             Constraint constraint)
        This method is invoked after run method
        Parameters:
        project - a project of the constraint.
        constraint - a constraint object.
      • run

        java.util.Set<Annotation> run​(Project project,
                                      Constraint constraint,
                                      java.util.Collection<? extends Element> elements)
        Implementation of the method should perform validating of the specified model elements using specified constraint. The method returns a set of Annotation 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 the ElementValidationRuleImpl will become no longer needed.