Package de.gebit.integrity.validation

## Class DSLJavaValidator

- java.lang.Object
- - org.eclipse.xtext.validation.AbstractInjectableValidator
  - - org.eclipse.xtext.validation.AbstractDeclarativeValidator
    - - de.gebit.integrity.validation.AbstractDSLJavaValidator
      - - de.gebit.integrity.validation.DSLJavaValidator

- All Implemented Interfaces:
    `org.eclipse.emf.ecore.EValidator`, `org.eclipse.xtext.validation.ValidationMessageAcceptor`

      public class DSLJavaValidator
      extends AbstractDSLJavaValidator

  These validators perform some more extensive validation on parts of the syntax tree.
  Author:
    Rene Schneider - initial API and implementation

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator

      `org.eclipse.xtext.validation.AbstractDeclarativeValidator.MethodWrapper, org.eclipse.xtext.validation.AbstractDeclarativeValidator.State, org.eclipse.xtext.validation.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`

  - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static String` | `SHORTENABLE_REFERENCE` |
    `static String` | `UNUSED_IMPORT` |

    - ### Fields inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator

      `CURRENT_LANGUAGE_NAME, ISSUE_SEVERITIES`

    - ### Fields inherited from interface org.eclipse.emf.ecore.EValidator

      `MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE`

    - ### Fields inherited from interface org.eclipse.xtext.validation.ValidationMessageAcceptor

      `INSIGNIFICANT_INDEX`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `DSLJavaValidator()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `_checkParameter​(Call aCall)` | Polymorphic Dispatch of `#checkParameter(Call)`.
    `protected void` | `_checkParameter​(SuiteStatementWithResult aCall)` | Polymorphic Dispatch Default Case of `#checkParameter(Call)`.
    `protected void` | `_checkParameter​(TableTest aTableTest)` | Polymorphic Dispatch of `#checkParameter(Call)`.
    `protected void` | `_checkParameter​(Test aTest)` | Polymorphic Dispatch of `#checkParameter(Call)`.
    `protected void` | `checkForMissingParameter​(Set<String> someMandatoryParameters, Set<String> someSpecifiedParameter)` | Checks if some parameter is missing and reports this.
    `protected Set<String>` | `checkForNonNullableParameter​(MethodReference aMethod, List<Parameter> someParameters)` | Checks if the given method has a parameter that is non-nullable, but for which a null value is statically provided.
    `void` | `checkForPrivateConstantInSuite​(ConstantDefinition anEntity)` | Checks for redundant private modifier.
    `void` | `checkForPrivateVariableInSuite​(VariableDefinition anEntity)` | Checks for redundant private modifier.
    `void` | `checkForShortenableReferences​(PackageDefinition aDefinition)` |
    `void` | `checkForUnusedImports​(Model aModel)` |
    `void` | `checkIfCallDefinitionsAreValid​(CallDefinition anEntity)` | Checks whether a definition contains dots, which would be illegal (issue #174).
    `void` | `checkIfConstantDefinitionsAreValid​(ConstantDefinition anEntity)` | Checks whether a constant definition contains dots, which would be illegal (issue #171).
    `void` | `checkIfConstantParameterizationIsPossible​(ConstantDefinition aConstant)` | Checks whether a parameterized constant is defined in a package scope.
    `void` | `checkIfDateAndTimesAreValid​(DateAndTimeValue aValue)` | Checks whether a given `DateAndTimeValue` is actually correct.
    `void` | `checkIfDatesAreValid​(DateValue aValue)` | Checks whether a given `DateValue` is actually correct (finds errors like days which don't exist in the given month).
    `void` | `checkIfForkDefinitionsAreValid​(ForkDefinition anEntity)` | Checks whether a definition contains dots, which would be illegal (issue #174).
    `void` | `checkIfOperationDefinitionsAreValid​(OperationDefinition anEntity)` | Checks whether a definition contains dots, which would be illegal (issue #174).
    `void` | `checkIfRegexIsValid​(RegexValue aValue)` | Checks whether a given regex is valid.
    `void` | `checkIfSuiteDefinitionsAreValid​(SuiteDefinition anEntity)` | Checks whether a definition contains dots, which would be illegal (issue #174).
    `void` | `checkIfTestDefinitionsAreValid​(TestDefinition anEntity)` | Checks whether a definition contains dots, which would be illegal (issue #174).
    `void` | `checkIfTimesAreValid​(TimeValue aValue)` | Checks whether a given `TimeValue` is actually correct.
    `void` | `checkIfVariableDefinitionsAreValid​(VariableDefinition anEntity)` | Checks whether a variable definition contains dots, which would be illegal (issue #10).
    `void` | `checkIfVariantDefinitionsAreValid​(VariantDefinition anEntity)` | Checks whether a definition contains dots, which would be illegal (issue #174).
    `protected void` | `checkParameter​(Parameter aParameter)` | Checks for duplicate parameters.
    `void` | `checkParameter​(SuiteStatementWithResult aCall)` | Checks for missing parameters.
    `void` | `checkSuiteParameter​(SuiteParameter aParameter)` | Checks for redundant suite parameters.
    `void` | `checkSuiteReturn​(SuiteReturn aReturn)` | Checks for redundant suite results.
    `void` | `checkSuiteStatement​(Suite aSuiteStatement)` | Checks for redundant suite inline statements.
    `protected Set<String>` | `collectMandatoryParameterNames​(Collection<FixtureParameterAssessment> aCollection)` | Collects all mandatory parameter names and returns them.
    `protected Set<String>` | `collectNonNullableParameterNames​(Collection<FixtureParameterAssessment> aCollection)` | Collects all non-nullable parameter names and returns them.
    `void` | `enableEditTimeValidations()` |
    `protected void` | `ensureParameterIsNotNullValue​(org.eclipse.emf.ecore.EObject aParameterObject, org.eclipse.emf.ecore.EObject aParameterValue)` | If the provided parameter is linked to a static null value, an error is generated.
    `protected Set<String>` | `getMandatoryParameterNamesOf​(MethodReference aMethod)` | Extracts all mandatory parameter names from the given method reference.
    `protected void` | `performDotCheck​(String aName, String anEntity)` | A generic dot-checking method for entity names.
    `protected void` | `performDotCheck​(String aName, String anEntityType, org.eclipse.emf.ecore.EStructuralFeature aStructuralFeature)` | A generic dot-checking method for entity names.
    `protected void` | `performSuiteParameterShadowingCheck​(String aName, org.eclipse.emf.ecore.EObject aContainer, String anEntityType, org.eclipse.emf.ecore.EStructuralFeature aStructuralFeature)` | Checks for variable entities that overshadow suite input or return parameters.
    `void` | `setReferenceLengthTarget​(int aTarget)` |
    `void` | `setWarnUnusedImports​(boolean aValue)` |
    `List<FixtureParameterAssessment>` | `wrap​(Iterable<org.eclipse.xtext.util.Pair<org.eclipse.xtext.common.types.JvmFormalParameter,​org.eclipse.xtext.common.types.JvmAnnotationReference>> someParameters)` | Wraps the parameter/annotation tuples in assessment objects for easier access and caches the processing results.

    - ### Methods inherited from class de.gebit.integrity.validation.AbstractDSLJavaValidator

      `getEPackages`

    - ### Methods inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator

      `acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, addIssue, addIssue, addIssue, addIssue, addIssue, addIssueToState, checkDone, checkIsFromCurrentlyCheckedResource, createDiagnostic, createDiagnostic, createMethodWrapper, error, error, error, error, error, error, error, error, getCancelIndicator, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getIssueSeverities, getMessageAcceptor, guard, handleExceptionDuringValidation, info, info, info, info, info, info, info, info, internalValidate, isIgnored, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning, warning`

    - ### Methods inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator

      `getCurrentLanguage, isLanguageSpecific, isResponsible, register, validate, validate, validate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SHORTENABLE_REFERENCE

          public static final String SHORTENABLE_REFERENCE

      See Also:
        Constant Field Values

    - #### UNUSED_IMPORT

          public static final String UNUSED_IMPORT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DSLJavaValidator

          public DSLJavaValidator()

  - ### Method Detail

    - #### setReferenceLengthTarget

          public void setReferenceLengthTarget​(int aTarget)

    - #### enableEditTimeValidations

          public void enableEditTimeValidations()

    - #### setWarnUnusedImports

          public void setWarnUnusedImports​(boolean aValue)

    - #### checkForShortenableReferences

          public void checkForShortenableReferences​(PackageDefinition aDefinition)

    - #### checkForUnusedImports

          public void checkForUnusedImports​(Model aModel)

    - #### checkIfDatesAreValid

          public void checkIfDatesAreValid​(DateValue aValue)

      Checks whether a given `DateValue` is actually correct (finds errors like days which don't exist in the given month).
      Parameters:
        `aValue` -

    - #### checkIfTimesAreValid

          public void checkIfTimesAreValid​(TimeValue aValue)

      Checks whether a given `TimeValue` is actually correct.
      Parameters:
        `aValue` -

    - #### checkIfDateAndTimesAreValid

          public void checkIfDateAndTimesAreValid​(DateAndTimeValue aValue)

      Checks whether a given `DateAndTimeValue` is actually correct.
      Parameters:
        `aValue` -

    - #### checkIfRegexIsValid

          public void checkIfRegexIsValid​(RegexValue aValue)

      Checks whether a given regex is valid.
      Parameters:
        `aValue` -

    - #### checkIfVariableDefinitionsAreValid

          public void checkIfVariableDefinitionsAreValid​(VariableDefinition anEntity)

      Checks whether a variable definition contains dots, which would be illegal (issue #10).
      Parameters:
        `anEntity` -

    - #### checkIfConstantDefinitionsAreValid

          public void checkIfConstantDefinitionsAreValid​(ConstantDefinition anEntity)

      Checks whether a constant definition contains dots, which would be illegal (issue #171).
      Parameters:
        `anEntity` -

    - #### checkIfForkDefinitionsAreValid

          public void checkIfForkDefinitionsAreValid​(ForkDefinition anEntity)

      Checks whether a definition contains dots, which would be illegal (issue #174).
      Parameters:
        `anEntity` -

    - #### checkIfVariantDefinitionsAreValid

          public void checkIfVariantDefinitionsAreValid​(VariantDefinition anEntity)

      Checks whether a definition contains dots, which would be illegal (issue #174).
      Parameters:
        `anEntity` -

    - #### checkIfSuiteDefinitionsAreValid

          public void checkIfSuiteDefinitionsAreValid​(SuiteDefinition anEntity)

      Checks whether a definition contains dots, which would be illegal (issue #174).
      Parameters:
        `anEntity` -

    - #### checkIfOperationDefinitionsAreValid

          public void checkIfOperationDefinitionsAreValid​(OperationDefinition anEntity)

      Checks whether a definition contains dots, which would be illegal (issue #174).
      Parameters:
        `anEntity` -

    - #### checkIfCallDefinitionsAreValid

          public void checkIfCallDefinitionsAreValid​(CallDefinition anEntity)

      Checks whether a definition contains dots, which would be illegal (issue #174).
      Parameters:
        `anEntity` -

    - #### checkIfTestDefinitionsAreValid

          public void checkIfTestDefinitionsAreValid​(TestDefinition anEntity)

      Checks whether a definition contains dots, which would be illegal (issue #174).
      Parameters:
        `anEntity` -

    - #### performDotCheck

          protected void performDotCheck​(String aName,
                                         String anEntity)

      A generic dot-checking method for entity names. Generates a nice error message.
      Parameters:
        `aName` -
        `anEntity` -

    - #### performDotCheck

          protected void performDotCheck​(String aName,
                                         String anEntityType,
                                         org.eclipse.emf.ecore.EStructuralFeature aStructuralFeature)

      A generic dot-checking method for entity names. Generates a nice error message.
      Parameters:
        `aName` -
        `anEntityType` -

    - #### performSuiteParameterShadowingCheck

          protected void performSuiteParameterShadowingCheck​(String aName,
                                                             org.eclipse.emf.ecore.EObject aContainer,
                                                             String anEntityType,
                                                             org.eclipse.emf.ecore.EStructuralFeature aStructuralFeature)

      Checks for variable entities that overshadow suite input or return parameters.
      Parameters:
        `aName` -
        `aContainer` -
        `anEntityType` -
        `aStructuralFeature` -

    - #### checkIfConstantParameterizationIsPossible

          public void checkIfConstantParameterizationIsPossible​(ConstantDefinition aConstant)

      Checks whether a parameterized constant is defined in a package scope. It is not supported currently within suites.
      Parameters:
        `aConstant` -

    - #### checkForPrivateVariableInSuite

          public void checkForPrivateVariableInSuite​(VariableDefinition anEntity)

      Checks for redundant private modifier.
      Parameters:
        `anEntity` -

    - #### checkForPrivateConstantInSuite

          public void checkForPrivateConstantInSuite​(ConstantDefinition anEntity)

      Checks for redundant private modifier.
      Parameters:
        `anEntity` -

    - #### checkSuiteStatement

          public void checkSuiteStatement​(Suite aSuiteStatement)

      Checks for redundant suite inline statements.
      Parameters:
        `aSuiteStatement` -

    - #### checkSuiteParameter

          public void checkSuiteParameter​(SuiteParameter aParameter)

      Checks for redundant suite parameters.
      Parameters:
        `aParameter` -

    - #### checkSuiteReturn

          public void checkSuiteReturn​(SuiteReturn aReturn)

      Checks for redundant suite results.
      Parameters:
        `aReturn` -

    - #### checkParameter

          public void checkParameter​(SuiteStatementWithResult aCall)

      Checks for missing parameters.
      Parameters:
        `aCall` - Call to be verified.

    - #### _checkParameter

          protected void _checkParameter​(Call aCall)

      Polymorphic Dispatch of `#checkParameter(Call)`.

    - #### _checkParameter

          protected void _checkParameter​(Test aTest)

      Polymorphic Dispatch of `#checkParameter(Call)`.

    - #### _checkParameter

          protected void _checkParameter​(TableTest aTableTest)

      Polymorphic Dispatch of `#checkParameter(Call)`.

    - #### _checkParameter

          protected void _checkParameter​(SuiteStatementWithResult aCall)

      Polymorphic Dispatch Default Case of `#checkParameter(Call)`.

    - #### checkParameter

          protected void checkParameter​(Parameter aParameter)

      Checks for duplicate parameters.
      Parameters:
        `aParameter` - the parameter to be checked

    - #### getMandatoryParameterNamesOf

          protected Set<String> getMandatoryParameterNamesOf​(MethodReference aMethod)

      Extracts all mandatory parameter names from the given method reference.
      Parameters:
        `aMethod` - Method where to get the parameter names from.
      Returns:
        All mandatory parameter names.

    - #### checkForMissingParameter

          protected void checkForMissingParameter​(Set<String> someMandatoryParameters,
                                                  Set<String> someSpecifiedParameter)

      Checks if some parameter is missing and reports this.
      Parameters:
        `someMandatoryParameters` - Mandatory parameter names.
        `someSpecifiedParameter` - Specified parameter names.

    - #### checkForNonNullableParameter

          protected Set<String> checkForNonNullableParameter​(MethodReference aMethod,
                                                             List<Parameter> someParameters)

      Checks if the given method has a parameter that is non-nullable, but for which a null value is statically provided.
      Parameters:
        `aMethod` - the method to check
        `someParameters` - the parameters to check
      Returns:
        the set of non-nullable parameters if any non-nullable parameters are present in the fixture method (regardless of whether violations were found), null otherwise

    - #### ensureParameterIsNotNullValue

          protected void ensureParameterIsNotNullValue​(org.eclipse.emf.ecore.EObject aParameterObject,
                                                       org.eclipse.emf.ecore.EObject aParameterValue)

      If the provided parameter is linked to a static null value, an error is generated.
      Parameters:
        `aParameter` -

    - #### wrap

          public List<FixtureParameterAssessment> wrap​(Iterable<org.eclipse.xtext.util.Pair<org.eclipse.xtext.common.types.JvmFormalParameter,​org.eclipse.xtext.common.types.JvmAnnotationReference>> someParameters)

      Wraps the parameter/annotation tuples in assessment objects for easier access and caches the processing results.
      Parameters:
        `someParameters` - Parameters to wrap
      Returns:
        Assessment classes for easier access.

    - #### collectMandatoryParameterNames

          protected Set<String> collectMandatoryParameterNames​(Collection<FixtureParameterAssessment> aCollection)

      Collects all mandatory parameter names and returns them.
      Parameters:
        `aCollection` - Some parameter to get the mandatory names from.
      Returns:

    - #### collectNonNullableParameterNames

          protected Set<String> collectNonNullableParameterNames​(Collection<FixtureParameterAssessment> aCollection)

      Collects all non-nullable parameter names and returns them.
      Parameters:
        `aCollection` - Some parameter to get the mandatory names from.
      Returns: