Class EMFPatternLanguageJvmModelInferrerUtil


  • public class EMFPatternLanguageJvmModelInferrerUtil
    extends java.lang.Object
    Utility class for the EMFPatternLanguageJvmModelInferrer.
    Since:
    2.0
    • 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
      • 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
      • matchImmutableInnerClassName

        public java.lang.String matchImmutableInnerClassName​(Pattern pattern)
      • matchMutableInnerClassName

        public java.lang.String matchMutableInnerClassName​(Pattern pattern)
      • 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