Class AbstractDeclarativeValidator

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  AbstractDeclarativeValidator.MethodWrapper  
      static class  AbstractDeclarativeValidator.State  
      static class  AbstractDeclarativeValidator.StateAccess  
      • Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.EValidator

        org.eclipse.emf.ecore.EValidator.Descriptor, org.eclipse.emf.ecore.EValidator.PatternMatcher, org.eclipse.emf.ecore.EValidator.Registry, org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider, org.eclipse.emf.ecore.EValidator.ValidationDelegate
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acceptError​(java.lang.String message, org.eclipse.emf.ecore.EObject object, int offset, int length, java.lang.String code, java.lang.String... issueData)
      Annotate a range of the resource with an error.
      void acceptError​(java.lang.String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)
      Annotate an instance, a feature value, or all feature values with an error.
      void acceptInfo​(java.lang.String message, org.eclipse.emf.ecore.EObject object, int offset, int length, java.lang.String code, java.lang.String... issueData)
      Annotate a range of the resource with an info message..
      void acceptInfo​(java.lang.String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)
      Annotate an instance, a feature value, or all feature values with an info message.
      void acceptWarning​(java.lang.String message, org.eclipse.emf.ecore.EObject object, int offset, int length, java.lang.String code, java.lang.String... issueData)
      Annotate a range of the resource with a warning.
      void acceptWarning​(java.lang.String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)
      Annotate an instance, a feature value, or all feature values with a warning.
      protected void addIssue​(java.lang.String message, org.eclipse.emf.ecore.EObject source, int offset, int length, java.lang.String issueCode)  
      protected void addIssue​(java.lang.String message, org.eclipse.emf.ecore.EObject source, int offset, int length, java.lang.String issueCode, java.lang.String... issueData)  
      protected void addIssue​(java.lang.String message, org.eclipse.emf.ecore.EObject source, java.lang.String issueCode)  
      protected void addIssue​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String issueCode, java.lang.String... issueData)  
      protected void addIssue​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String issueCode, java.lang.String... issueData)  
      protected void addIssueToState​(java.lang.String issueCode, java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void checkDone()  
      protected void checkIsFromCurrentlyCheckedResource​(org.eclipse.emf.ecore.EObject object)  
      protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(Severity severity, java.lang.String message, org.eclipse.emf.ecore.EObject object, int offset, int length, java.lang.String code, java.lang.String... issueData)  
      protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(Severity severity, java.lang.String message, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected AbstractDeclarativeValidator.MethodWrapper createMethodWrapper​(AbstractDeclarativeValidator instanceToUse, java.lang.reflect.Method method)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, int index)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected void error​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)  
      protected org.eclipse.xtext.util.CancelIndicator getCancelIndicator()
      Obtain a cancel indicator that is valid for the current validation run.
      protected org.eclipse.emf.common.util.DiagnosticChain getChain()  
      protected CheckMode getCheckMode()  
      protected java.util.Map<java.lang.Object,​java.lang.Object> getContext()  
      protected java.lang.reflect.Method getCurrentMethod()  
      protected org.eclipse.emf.ecore.EObject getCurrentObject()  
      protected IssueSeverities getIssueSeverities​(java.util.Map<java.lang.Object,​java.lang.Object> context, org.eclipse.emf.ecore.EObject eObject)  
      ValidationMessageAcceptor getMessageAcceptor()  
      protected void guard​(boolean guardExpression)  
      protected void handleExceptionDuringValidation​(java.lang.Throwable targetException)
      Handles exceptions occuring during execution of validation code.
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, int index)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected void info​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)  
      protected boolean internalValidate​(org.eclipse.emf.ecore.EClass class1, org.eclipse.emf.ecore.EObject object, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,​java.lang.Object> context)  
      protected boolean isIgnored​(java.lang.String issueCode)  
      protected AbstractDeclarativeValidator newInstance​(java.lang.Class<? extends AbstractDeclarativeValidator> clazz)  
      void setInjector​(com.google.inject.Injector injector)  
      AbstractDeclarativeValidator.StateAccess setMessageAcceptor​(ValidationMessageAcceptor messageAcceptor)  
      protected int toDiagnosticSeverity​(Severity severity)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, int index)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, int index, java.lang.String code, java.lang.String... issueData)  
      protected void warning​(java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractDeclarativeValidator

        public AbstractDeclarativeValidator()
    • Method Detail

      • setInjector

        public void setInjector​(com.google.inject.Injector injector)
      • getCurrentObject

        protected org.eclipse.emf.ecore.EObject getCurrentObject()
      • getCurrentMethod

        protected java.lang.reflect.Method getCurrentMethod()
      • getChain

        protected org.eclipse.emf.common.util.DiagnosticChain getChain()
      • getCheckMode

        protected CheckMode getCheckMode()
      • getContext

        protected java.util.Map<java.lang.Object,​java.lang.Object> getContext()
      • getCancelIndicator

        protected org.eclipse.xtext.util.CancelIndicator getCancelIndicator()
        Obtain a cancel indicator that is valid for the current validation run.
        Since:
        2.22
      • internalValidate

        protected final boolean internalValidate​(org.eclipse.emf.ecore.EClass class1,
                                                 org.eclipse.emf.ecore.EObject object,
                                                 org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                                                 java.util.Map<java.lang.Object,​java.lang.Object> context)
        Specified by:
        internalValidate in class AbstractInjectableValidator
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EStructuralFeature feature)
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            int index)
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            int index,
                            java.lang.String code,
                            java.lang.String... issueData)
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.lang.String code,
                            java.lang.String... issueData)
        Since:
        2.0
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature)
        Since:
        2.4
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            int index)
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            int index,
                            java.lang.String code,
                            java.lang.String... issueData)
        Since:
        2.4
      • info

        protected void info​(java.lang.String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.lang.String code,
                            java.lang.String... issueData)
        Since:
        2.4
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EStructuralFeature feature)
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               int index)
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               java.lang.String code,
                               java.lang.String... issueData)
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               int index,
                               java.lang.String code,
                               java.lang.String... issueData)
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EObject source,
                               org.eclipse.emf.ecore.EStructuralFeature feature)
        Since:
        2.4
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EObject source,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               int index)
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EObject source,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               int index,
                               java.lang.String code,
                               java.lang.String... issueData)
      • warning

        protected void warning​(java.lang.String message,
                               org.eclipse.emf.ecore.EObject source,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               java.lang.String code,
                               java.lang.String... issueData)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EStructuralFeature feature)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             int index)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             java.lang.String code,
                             java.lang.String... issueData)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             int index,
                             java.lang.String code,
                             java.lang.String... issueData)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EObject source,
                             org.eclipse.emf.ecore.EStructuralFeature feature)
        Since:
        2.4
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EObject source,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             int index)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EObject source,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             java.lang.String code,
                             java.lang.String... issueData)
      • error

        protected void error​(java.lang.String message,
                             org.eclipse.emf.ecore.EObject source,
                             org.eclipse.emf.ecore.EStructuralFeature feature,
                             int index,
                             java.lang.String code,
                             java.lang.String... issueData)
      • addIssueToState

        protected void addIssueToState​(java.lang.String issueCode,
                                       java.lang.String message,
                                       org.eclipse.emf.ecore.EStructuralFeature feature)
        Since:
        2.4
      • addIssue

        protected void addIssue​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject source,
                                java.lang.String issueCode)
        Since:
        2.4
      • addIssue

        protected void addIssue​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject source,
                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                java.lang.String issueCode,
                                java.lang.String... issueData)
        Since:
        2.4
      • addIssue

        protected void addIssue​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject source,
                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                int index,
                                java.lang.String issueCode,
                                java.lang.String... issueData)
        Since:
        2.4
      • addIssue

        protected void addIssue​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject source,
                                int offset,
                                int length,
                                java.lang.String issueCode)
        Since:
        2.4
      • addIssue

        protected void addIssue​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject source,
                                int offset,
                                int length,
                                java.lang.String issueCode,
                                java.lang.String... issueData)
        Since:
        2.4
      • isIgnored

        protected boolean isIgnored​(java.lang.String issueCode)
        Since:
        2.4
      • getIssueSeverities

        protected IssueSeverities getIssueSeverities​(java.util.Map<java.lang.Object,​java.lang.Object> context,
                                                     org.eclipse.emf.ecore.EObject eObject)
        Since:
        2.4
      • guard

        protected void guard​(boolean guardExpression)
      • checkDone

        protected void checkDone()
      • acceptError

        public void acceptError​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject object,
                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                int index,
                                java.lang.String code,
                                java.lang.String... issueData)
        Description copied from interface: ValidationMessageAcceptor
        Annotate an instance, a feature value, or all feature values with an error.
        Specified by:
        acceptError in interface ValidationMessageAcceptor
        Parameters:
        message - the error message. May not be null.
        object - the object or the feature holder. May not be null.
        feature - the feature or null if the complete instance should be annotated.
        index - the index of the erroneous value or -1 if all values are considered to be invalid. The index is ignored if the feature is null or the feature is a single value feature.
        code - the optional issue code.
        issueData - the optional issue data.
      • checkIsFromCurrentlyCheckedResource

        protected void checkIsFromCurrentlyCheckedResource​(org.eclipse.emf.ecore.EObject object)
        Since:
        2.4
      • acceptWarning

        public void acceptWarning​(java.lang.String message,
                                  org.eclipse.emf.ecore.EObject object,
                                  org.eclipse.emf.ecore.EStructuralFeature feature,
                                  int index,
                                  java.lang.String code,
                                  java.lang.String... issueData)
        Description copied from interface: ValidationMessageAcceptor
        Annotate an instance, a feature value, or all feature values with a warning.
        Specified by:
        acceptWarning in interface ValidationMessageAcceptor
        Parameters:
        message - the warning message. May not be null.
        object - the object or the feature holder. May not be null.
        feature - the feature or null if the complete instance should be annotated.
        index - the index of the relevant value or -1 if all values are considered to be affected. The index is ignored if the feature is null or the feature is a single value feature.
        code - the optional issue code.
        issueData - the optional issue data.
      • acceptInfo

        public void acceptInfo​(java.lang.String message,
                               org.eclipse.emf.ecore.EObject object,
                               org.eclipse.emf.ecore.EStructuralFeature feature,
                               int index,
                               java.lang.String code,
                               java.lang.String... issueData)
        Description copied from interface: ValidationMessageAcceptor
        Annotate an instance, a feature value, or all feature values with an info message.
        Specified by:
        acceptInfo in interface ValidationMessageAcceptor
        Parameters:
        message - the info message. May not be null.
        object - the object or the feature holder. May not be null.
        feature - the feature or null if the complete instance should be annotated.
        index - the index of the interesting value or -1 if all values are considered to be interesting. The index is ignored if the feature is null or the feature is a single value feature.
        code - the optional issue code.
        issueData - the optional issue data.
      • acceptError

        public void acceptError​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject object,
                                int offset,
                                int length,
                                java.lang.String code,
                                java.lang.String... issueData)
        Description copied from interface: ValidationMessageAcceptor
        Annotate a range of the resource with an error.
        Specified by:
        acceptError in interface ValidationMessageAcceptor
        Parameters:
        message - the error message. May not be null.
        offset - the absolute offset in the resource.
        length - the length of the erroneous range.
        code - the optional issue code.
        issueData - the optional issue data.
      • acceptWarning

        public void acceptWarning​(java.lang.String message,
                                  org.eclipse.emf.ecore.EObject object,
                                  int offset,
                                  int length,
                                  java.lang.String code,
                                  java.lang.String... issueData)
        Description copied from interface: ValidationMessageAcceptor
        Annotate a range of the resource with a warning.
        Specified by:
        acceptWarning in interface ValidationMessageAcceptor
        Parameters:
        message - the warning message. May not be null.
        offset - the absolute offset in the resource.
        length - the length of the invalid range.
        code - the optional issue code.
        issueData - the optional issue data.
      • acceptInfo

        public void acceptInfo​(java.lang.String message,
                               org.eclipse.emf.ecore.EObject object,
                               int offset,
                               int length,
                               java.lang.String code,
                               java.lang.String... issueData)
        Description copied from interface: ValidationMessageAcceptor
        Annotate a range of the resource with an info message..
        Specified by:
        acceptInfo in interface ValidationMessageAcceptor
        Parameters:
        message - the info message. May not be null.
        offset - the absolute offset in the resource.
        length - the length of the annotated range.
        code - the optional issue code.
        issueData - the optional issue data.
      • createDiagnostic

        protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(Severity severity,
                                                                          java.lang.String message,
                                                                          org.eclipse.emf.ecore.EObject object,
                                                                          org.eclipse.emf.ecore.EStructuralFeature feature,
                                                                          int index,
                                                                          java.lang.String code,
                                                                          java.lang.String... issueData)
      • createDiagnostic

        protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(Severity severity,
                                                                          java.lang.String message,
                                                                          org.eclipse.emf.ecore.EObject object,
                                                                          int offset,
                                                                          int length,
                                                                          java.lang.String code,
                                                                          java.lang.String... issueData)
      • toDiagnosticSeverity

        protected int toDiagnosticSeverity​(Severity severity)
      • handleExceptionDuringValidation

        protected void handleExceptionDuringValidation​(java.lang.Throwable targetException)
                                                throws java.lang.RuntimeException
        Handles exceptions occuring during execution of validation code. By default this method will swallow NullPointerExceptions and GuardExceptions. Clients may override this method to propagate NullPointerExceptions or more smarter handling.
        Throws:
        java.lang.RuntimeException
        Since:
        2.17