org.eclipse.viatra.query.patternlanguage.emf.jvmmodel

## Class EMFPatternLanguageJvmModelInferrerUtil

- java.lang.Object
- - org.eclipse.viatra.query.patternlanguage.emf.jvmmodel.EMFPatternLanguageJvmModelInferrerUtil

-     public class EMFPatternLanguageJvmModelInferrerUtil
      extends java.lang.Object

  Utility class for the EMFPatternLanguageJvmModelInferrer.
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EMFPatternLanguageJvmModelInferrerUtil()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendInputKey(org.eclipse.xtend2.lib.StringConcatenationClient.TargetStringConcatenation target, IInputKey key, boolean forParameter)` Output code is intended for generated query specification classes, since it depends on 'getFeatureLiteral()' / 'getClassifierLiteral()'
    `org.eclipse.xtext.common.types.JvmTypeReference` | `calculateType(Variable variable)` Calls the typeProvider.
    `java.lang.String` | `escapeToQuotedString(java.lang.String inputString)` Escapes the input to be usable in literal strings
    `java.lang.String` | `expressionMethodName(org.eclipse.xtext.xbase.XExpression ex)`
    `java.lang.String` | `fieldName(Variable variable)` Returns field name for Variable
    `org.eclipse.xtext.common.types.JvmType` | `findInferredClass(org.eclipse.emf.ecore.EObject pattern, java.lang.Class<?>... clazzes)` Returns an inferred class with a predefined direct subtype (one of the given values)
    `org.eclipse.xtext.common.types.JvmType` | `findInferredClass(org.eclipse.emf.ecore.EObject pattern, java.lang.Class<?> clazz)` Returns an inferred class with a predefined direct subtype
    `org.eclipse.xtext.common.types.JvmType` | `findInferredSpecification(Pattern pattern)`
    `org.eclipse.xtext.common.types.JvmType` | `findMatchClass(Pattern pattern)`
    `org.eclipse.xtext.common.types.JvmType` | `findMatcherClass(Pattern pattern)`
    `java.lang.String` | `getFileComment(Pattern pattern)` Returns the file header comment at the beginning of the text corresponding to the pattern model containing the given pattern.
    `java.lang.String` | `getFileComment(PatternModel patternModel)` Returns the file header comment at the beginning of the text corresponding to the pattern model.
    `java.lang.String` | `getInternalSpecificationPackage(Pattern pattern)`
    `java.lang.String` | `getPackageName(Pattern pattern)` Returns the packageName: PatternModel.packageName or "" when nullOrEmpty.
    `java.lang.String` | `getPackageNameOld(Pattern pattern)` Returns the packageName: PatternModel.packageName + Pattern.name, packageName is ignored, when nullOrEmpty.
    `java.lang.String` | `getPackagePath(Pattern pattern)`
    `java.lang.String` | `getPackagePath(java.lang.String fqn)` Calculates the correct package path for a selected fqn
    `java.lang.String` | `getPatternComment(Pattern pattern)`
    `java.lang.String` | `getPParameterName(java.lang.String parameterName)` Calculates the name of the variable that stores a PParameter for a pattern
    `java.lang.String` | `getterMethodName(Variable variable)` Returns correct getter method name for variable.
    `java.lang.String` | `getUtilPackageName(Pattern pattern)`
    `boolean` | `isCompatibleWith(org.eclipse.xtext.common.types.JvmType type, java.lang.Class<?> clazz)`
    `boolean` | `isPublic(Pattern pattern)`
    `java.lang.String` | `matchClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)` Returns the MatchClass name based on the Pattern's name
    `java.lang.String` | `matcherClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)` Returns the MatcherClass name based on the Pattern's name
    `java.lang.String` | `matchImmutableInnerClassName(Pattern pattern)`
    `java.lang.String` | `matchMutableInnerClassName(Pattern pattern)`
    `java.lang.String` | `modelFileName(org.eclipse.emf.ecore.EObject object)`
    `java.lang.String` | `modelFileQualifiedName(Pattern pattern)`
    `java.lang.String` | `parameterName(Variable variable)` Returns parameter name for Variable
    `java.lang.String` | `positionConstant(Variable variable)`
    `java.lang.String` | `processorClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)` Returns the ProcessorClass name based on the Pattern's name
    `java.lang.String` | `querySpecificationClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)` Returns the QuerySpecificationClass name based on the Pattern's name
    `java.lang.String` | `querySpecificationHolderClassName(Pattern pattern)` Returns the holder class name based on the Pattern's name
    `java.lang.String` | `querySpecificationPQueryClassName(Pattern pattern)` Returns the PQuery class name based on the Pattern's name
    `java.lang.String` | `realPatternName(Pattern pattern)` This method returns the pattern name.
    `java.lang.String` | `realPatternName(java.lang.String fqn)` This method returns the pattern name.
    `org.eclipse.xtend2.lib.StringConcatenationClient` | `serializeInputKey(IInputKey key, boolean forParameter)` Output code is intended for generated query specification classes, since it depends on 'getFeatureLiteral()' / 'getClassifierLiteral()'
    `java.lang.CharSequence` | `serializeToJava(org.eclipse.emf.ecore.EObject eObject)` Serializes the EObject into Java String variable.
    `java.lang.String` | `serializeToJavadoc(Pattern pattern)` Serializes the input for Javadoc
    `java.lang.String` | `setterMethodName(Variable variable)` Returns correct setter method name for variable.
    `boolean` | `validClassName(java.lang.String simpleName)`
    `java.util.List<Variable>` | `variables(org.eclipse.xtext.xbase.XExpression ex)`

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

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

- - ### Constructor Detail

    - #### EMFPatternLanguageJvmModelInferrerUtil

          public EMFPatternLanguageJvmModelInferrerUtil()

  - ### Method Detail

    - #### realPatternName

          public java.lang.String realPatternName(Pattern pattern)

      This method returns the pattern name. If the pattern name contains the package (any dot), then removes all segment except the last one.

    - #### validClassName

          public boolean validClassName(java.lang.String simpleName)

    - #### modelFileName

          public java.lang.String modelFileName(org.eclipse.emf.ecore.EObject object)

    - #### modelFileQualifiedName

          public java.lang.String modelFileQualifiedName(Pattern pattern)

      Since:
        2.0

    - #### querySpecificationClassName

          public java.lang.String querySpecificationClassName(Pattern pattern,
                                                              EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)

      Returns the QuerySpecificationClass name based on the Pattern's name
      Since:
        2.0

    - #### querySpecificationHolderClassName

          public java.lang.String querySpecificationHolderClassName(Pattern pattern)

      Returns the holder class name based on the Pattern's name

    - #### querySpecificationPQueryClassName

          public java.lang.String querySpecificationPQueryClassName(Pattern pattern)

      Returns the PQuery class name based on the Pattern's name

    - #### matcherClassName

          public java.lang.String matcherClassName(Pattern pattern,
                                                   EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)

      Returns the MatcherClass name based on the Pattern's name
      Since:
        2.0

    - #### matchClassName

          public java.lang.String matchClassName(Pattern pattern,
                                                 EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)

      Returns the MatchClass name based on the Pattern's name
      Since:
        2.0

    - #### matchImmutableInnerClassName

          public java.lang.String matchImmutableInnerClassName(Pattern pattern)

    - #### matchMutableInnerClassName

          public java.lang.String matchMutableInnerClassName(Pattern pattern)

    - #### processorClassName

          public java.lang.String processorClassName(Pattern pattern,
                                                     EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)

      Returns the ProcessorClass name based on the Pattern's name
      Since:
        2.0

    - #### fieldName

          public java.lang.String fieldName(Variable variable)

      Returns field name for Variable

    - #### parameterName

          public java.lang.String parameterName(Variable variable)

      Returns parameter name for Variable

    - #### positionConstant

          public java.lang.String positionConstant(Variable variable)

    - #### getterMethodName

          public java.lang.String getterMethodName(Variable variable)

      Returns correct getter method name for variable. For variable with name 'class' returns getValueOfClass, otherwise returns `get#variable.name.toFirstUpper#`.

    - #### setterMethodName

          public java.lang.String setterMethodName(Variable variable)

      Returns correct setter method name for variable. Currently returns `set#variable.name.toFirstUpper#`.

    - #### calculateType

          public org.eclipse.xtext.common.types.JvmTypeReference calculateType(Variable variable)

      Calls the typeProvider.
      Returns:
        JvmTypeReference pointing the EClass that defines the Variable's type.
      See Also:
        `ITypeInferrer`

    - #### serializeToJava

          public java.lang.CharSequence serializeToJava(org.eclipse.emf.ecore.EObject eObject)

      Serializes the EObject into Java String variable.

    - #### serializeToJavadoc

          public java.lang.String serializeToJavadoc(Pattern pattern)

      Serializes the input for Javadoc

    - #### getFileComment

          public java.lang.String getFileComment(PatternModel patternModel)

      Returns the file header comment at the beginning of the text corresponding to the pattern model. The comment text is escaped, so it does not include stars in multi-line comments.
      Since:
        1.3

    - #### getPatternComment

          public java.lang.String getPatternComment(Pattern pattern)

    - #### getFileComment

          public java.lang.String getFileComment(Pattern pattern)

      Returns the file header comment at the beginning of the text corresponding to the pattern model containing the given pattern. The comment text is escaped, so it does not include stars in multi-line comments.
      Since:
        1.3

    - #### escapeToQuotedString

          public java.lang.String escapeToQuotedString(java.lang.String inputString)

      Escapes the input to be usable in literal strings

    - #### getPackageName

          public java.lang.String getPackageName(Pattern pattern)

      Returns the packageName: PatternModel.packageName or "" when nullOrEmpty.

    - #### getUtilPackageName

          public java.lang.String getUtilPackageName(Pattern pattern)

    - #### getInternalSpecificationPackage

          public java.lang.String getInternalSpecificationPackage(Pattern pattern)

      Since:
        1.6

    - #### getPackageNameOld

          public java.lang.String getPackageNameOld(Pattern pattern)

      Returns the packageName: PatternModel.packageName + Pattern.name, packageName is ignored, when nullOrEmpty.

    - #### getPackagePath

          public java.lang.String getPackagePath(Pattern pattern)

    - #### getPackagePath

          public java.lang.String getPackagePath(java.lang.String fqn)

      Calculates the correct package path for a selected fqn

    - #### realPatternName

          public java.lang.String realPatternName(java.lang.String fqn)

      This method returns the pattern name. If the pattern name contains the package (any dot), then removes all segment except the last one.

    - #### findInferredSpecification

          public org.eclipse.xtext.common.types.JvmType findInferredSpecification(Pattern pattern)

    - #### findMatchClass

          public org.eclipse.xtext.common.types.JvmType findMatchClass(Pattern pattern)

      Since:
        1.7

    - #### findMatcherClass

          public org.eclipse.xtext.common.types.JvmType findMatcherClass(Pattern pattern)

      Since:
        1.7

    - #### findInferredClass

          public org.eclipse.xtext.common.types.JvmType findInferredClass(org.eclipse.emf.ecore.EObject pattern,
                                                                          java.lang.Class<?> clazz)

      Returns an inferred class with a predefined direct subtype

    - #### findInferredClass

          public org.eclipse.xtext.common.types.JvmType findInferredClass(org.eclipse.emf.ecore.EObject pattern,
                                                                          java.lang.Class<?>... clazzes)

      Returns an inferred class with a predefined direct subtype (one of the given values)
      Parameters:
        `pattern` - the source pattern
        `clazzes` - a set of classes to check whether the inferred class has any as given values
      Since:
        1.6

    - #### isCompatibleWith

          public boolean isCompatibleWith(org.eclipse.xtext.common.types.JvmType type,
                                          java.lang.Class<?> clazz)

    - #### isPublic

          public boolean isPublic(Pattern pattern)

    - #### variables

          public java.util.List<Variable> variables(org.eclipse.xtext.xbase.XExpression ex)

    - #### expressionMethodName

          public java.lang.String expressionMethodName(org.eclipse.xtext.xbase.XExpression ex)

    - #### serializeInputKey

          public org.eclipse.xtend2.lib.StringConcatenationClient serializeInputKey(IInputKey key,
                                                                                    boolean forParameter)

      Output code is intended for generated query specification classes, since it depends on 'getFeatureLiteral()' / 'getClassifierLiteral()'

      the "safe" classifier lookup is used if the result is used for initializing a PParameter

    - #### getPParameterName

          public java.lang.String getPParameterName(java.lang.String parameterName)

      Calculates the name of the variable that stores a PParameter for a pattern
      Since:
        1.4

    - #### appendInputKey

          public void appendInputKey(org.eclipse.xtend2.lib.StringConcatenationClient.TargetStringConcatenation target,
                                     IInputKey key,
                                     boolean forParameter)

      Output code is intended for generated query specification classes, since it depends on 'getFeatureLiteral()' / 'getClassifierLiteral()'

      the "safe" classifier lookup is used if the result is used for initializing a PParameter