org.eclipse.incquery.patternlanguage.emf.util

## Class EMFPatternLanguageJvmModelInferrerUtil

- java.lang.Object
- - org.eclipse.incquery.patternlanguage.emf.util.EMFPatternLanguageJvmModelInferrerUtil

-     public class EMFPatternLanguageJvmModelInferrerUtil
      extends java.lang.Object

  Utility class for the EMFPatternLanguageJvmModelInferrer.
  Author:
    Mark Czotter

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EMFPatternLanguageJvmModelInferrerUtil()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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<?> clazz)`
    `org.eclipse.xtext.common.types.JvmType` | `findInferredSpecification(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` | `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)` Returns the MatchClass name based on the Pattern's name
    `java.lang.String` | `matcherClassName(Pattern pattern)` 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` | `parameterName(Variable variable)` Returns parameter name for Variable
    `java.lang.String` | `positionConstant(Variable variable)`
    `java.lang.String` | `processorClassName(Pattern pattern)` Returns the ProcessorClass name based on the Pattern's name
    `java.lang.String` | `querySpecificationClassName(Pattern pattern)` 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` | `querySpecificationProviderClassName(Pattern pattern)` Returns the IQuerySpecificationProvider 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.
    `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

      `equals, 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)

    - #### querySpecificationClassName

          public java.lang.String querySpecificationClassName(Pattern pattern)

      Returns the QuerySpecificationClass name based on the Pattern's name

    - #### querySpecificationProviderClassName

          public java.lang.String querySpecificationProviderClassName(Pattern pattern)

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

    - #### 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)

      Returns the MatcherClass name based on the Pattern's name

    - #### matchClassName

          public java.lang.String matchClassName(Pattern pattern)

      Returns the MatchClass name based on the Pattern's name

    - #### matchImmutableInnerClassName

          public java.lang.String matchImmutableInnerClassName(Pattern pattern)

    - #### matchMutableInnerClassName

          public java.lang.String matchMutableInnerClassName(Pattern pattern)

    - #### processorClassName

          public java.lang.String processorClassName(Pattern pattern)

      Returns the ProcessorClass name based on the Pattern's name

    - #### 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. See the XBaseUsageCrossReferencer class, possible solution for local variable usage TODO: improve type calculation
      Returns:
        JvmTypeReference pointing the EClass that defines the Variable's type.
      See Also:
        `EMFPatternTypeProvider`

    - #### 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

    - #### 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)

    - #### 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)

    - #### findInferredClass

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

    - #### 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)