Interface ValidationService

  • All Known Implementing Classes:
    ValidationServiceImpl

    public interface ValidationService
    Generic EMF validation service which allows validation of a collection of EObjects honoring defined EValidators. Additionally custom Validators can be registered i.e. if the feature set of the EValidators is insufficient.
    Author:
    Mat Hansen
    • Method Detail

      • addValidator

        void addValidator​(Validator validator)
        Adds a validation provider to the list of known validators.
        Parameters:
        validator - the Validator to add
      • removeValidator

        void removeValidator​(Validator validator)
        Removes a validation provider from the list of known validators.
        Parameters:
        validator - the Validator to remove
      • registerValidationFilter

        @Deprecated
        <Filter extends ValidationFilter> void registerValidationFilter​(Filter filter)
        Deprecated.
        Use addSubTreeFilter, addObjectFilter and addDiagnosticFilter instead
        Registers a validation filter.
        Type Parameters:
        Filter - an ValidationFilter implementation
        Parameters:
        filter - the ValidationFilter to register
      • unregisterValidationFilter

        @Deprecated
        <Filter extends ValidationFilter> void unregisterValidationFilter​(Filter filter)
        Deprecated.
        Use removeSubTreeFilter, removeObjectFilter and removeDiagnosticFilter instead
        Unregisters a validation filter.
        Type Parameters:
        Filter - an ValidationFilter implementation
        Parameters:
        filter - the ValidationFilter to unregister
      • setSubstitutionLabelProvider

        void setSubstitutionLabelProvider​(org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider substitutionLabelProvider)
        Set a EValidator.SubstitutionLabelProvider to be used for substituting labels in Diagnostics.
        Parameters:
        substitutionLabelProvider - the EValidator.SubstitutionLabelProvider to be set for this service
        See Also:
        EValidator.SubstitutionLabelProvider
      • validate

        org.eclipse.emf.common.util.Diagnostic validate​(org.eclipse.emf.ecore.EObject eObject)
        Validates the given eObject.
        Parameters:
        eObject - the eObject to validate
        Returns:
        the resulting Diagnostic, or null if the eObject is filtered by a ValidationFilter
      • validate

        java.util.Set<org.eclipse.emf.common.util.Diagnostic> validate​(java.util.Iterator<org.eclipse.emf.ecore.EObject> eObjects)
                                                                throws ValidationCanceledException
        Uses the given iterator to validate all eObjects in a collection.
        Parameters:
        eObjects - the list to validate
        Returns:
        the resulting set of Diagnostics
        Throws:
        ValidationCanceledException - in case cancel() has been called
      • isBusy

        boolean isBusy()
        Returns true as long as a validation is in process. Not applicable for single validation runs with validate(EObject). See cancel() to interrupt a running validation process.
        Returns:
        true as long as a validation is running, false otherwise.
      • cancel

        void cancel()
        Allows to cancel the current validation run (if any). Not applicable for single validation runs with validate(EObject).
      • addSubTreeFilter

        void addSubTreeFilter​(SubTreeFilter subTreeFilter)
        Adds a SubTreeFilter to skip specific sub trees during the validation. null is ignored.
        Parameters:
        subTreeFilter - SubTreeFilter
      • addObjectFilter

        void addObjectFilter​(ObjectFilter objectFilter)
        Adds an ObjectFilter to skip specific EObjects during the validation. null is ignored.
        Parameters:
        objectFilter - ObjectFilter