Class EMFPatternLanguageJvmModelInferrerUtil
- java.lang.Object
-
- org.eclipse.viatra.query.patternlanguage.emf.jvmmodel.EMFPatternLanguageJvmModelInferrerUtil
-
public class EMFPatternLanguageJvmModelInferrerUtil extends java.lang.ObjectUtility class for the EMFPatternLanguageJvmModelInferrer.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description EMFPatternLanguageJvmModelInferrerUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendInputKey(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.JvmTypeReferencecalculateType(Variable variable)Calls the typeProvider.java.lang.StringescapeToQuotedString(java.lang.String inputString)Escapes the input to be usable in literal stringsjava.lang.StringexpressionMethodName(org.eclipse.xtext.xbase.XExpression ex)java.lang.StringfieldName(Variable variable)Returns field name for Variableorg.eclipse.xtext.common.types.JvmTypefindInferredClass(org.eclipse.emf.ecore.EObject pattern, java.lang.Class<?> clazz)Returns an inferred class with a predefined direct subtypeorg.eclipse.xtext.common.types.JvmTypefindInferredClass(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.JvmTypefindInferredSpecification(Pattern pattern)org.eclipse.xtext.common.types.JvmTypefindMatchClass(Pattern pattern)org.eclipse.xtext.common.types.JvmTypefindMatcherClass(Pattern pattern)java.lang.StringgetFileComment(Pattern pattern)Returns the file header comment at the beginning of the text corresponding to the pattern model containing the given pattern.java.lang.StringgetFileComment(PatternModel patternModel)Returns the file header comment at the beginning of the text corresponding to the pattern model.java.lang.StringgetInternalSpecificationPackage(Pattern pattern)java.lang.StringgetPackageName(Pattern pattern)Returns the packageName: PatternModel.packageName or "" when nullOrEmpty.java.lang.StringgetPackageNameOld(Pattern pattern)Returns the packageName: PatternModel.packageName + Pattern.name, packageName is ignored, when nullOrEmpty.java.lang.StringgetPackagePath(java.lang.String fqn)Calculates the correct package path for a selected fqnjava.lang.StringgetPackagePath(Pattern pattern)java.lang.StringgetPatternComment(Pattern pattern)java.lang.StringgetPParameterName(java.lang.String parameterName)Calculates the name of the variable that stores a PParameter for a patternjava.lang.StringgetterMethodName(Variable variable)Returns correct getter method name for variable.java.lang.StringgetUtilPackageName(Pattern pattern)booleanisCompatibleWith(org.eclipse.xtext.common.types.JvmType type, java.lang.Class<?> clazz)booleanisPublic(Pattern pattern)java.lang.StringmatchClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)Returns the MatchClass name based on the Pattern's namejava.lang.StringmatcherClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)Returns the MatcherClass name based on the Pattern's namejava.lang.StringmatchImmutableInnerClassName(Pattern pattern)java.lang.StringmatchMutableInnerClassName(Pattern pattern)java.lang.StringmodelFileName(org.eclipse.emf.ecore.EObject object)java.lang.StringmodelFileQualifiedName(Pattern pattern)java.lang.StringparameterName(Variable variable)Returns parameter name for Variablejava.lang.StringpositionConstant(Variable variable)java.lang.StringprocessorClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)Returns the ProcessorClass name based on the Pattern's namejava.lang.StringquerySpecificationClassName(Pattern pattern, EMFPatternLanguageGeneratorConfig.MatcherGenerationStrategy strategy)Returns the QuerySpecificationClass name based on the Pattern's namejava.lang.StringquerySpecificationHolderClassName(Pattern pattern)Returns the holder class name based on the Pattern's namejava.lang.StringquerySpecificationPQueryClassName(Pattern pattern)Returns the PQuery class name based on the Pattern's namejava.lang.StringrealPatternName(java.lang.String fqn)This method returns the pattern name.java.lang.StringrealPatternName(Pattern pattern)This method returns the pattern name.org.eclipse.xtend2.lib.StringConcatenationClientserializeInputKey(IInputKey key, boolean forParameter)Output code is intended for generated query specification classes, since it depends on 'getFeatureLiteral()' / 'getClassifierLiteral()'java.lang.CharSequenceserializeToJava(org.eclipse.emf.ecore.EObject eObject)Serializes the EObject into Java String variable.java.lang.StringserializeToJavadoc(Pattern pattern)Serializes the input for Javadocjava.lang.StringsetterMethodName(Variable variable)Returns correct setter method name for variable.booleanvalidClassName(java.lang.String simpleName)java.util.List<Variable>variables(org.eclipse.xtext.xbase.XExpression ex)
-
-
-
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 returnsget#variable.name.toFirstUpper#.
-
setterMethodName
public java.lang.String setterMethodName(Variable variable)
Returns correct setter method name for variable. Currently returnsset#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 patternclazzes- 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
-
-