Class JvmModelGenerator

  • All Implemented Interfaces:
    org.eclipse.xtext.generator.IGenerator

    public class JvmModelGenerator
    extends java.lang.Object
    implements org.eclipse.xtext.generator.IGenerator
    A generator implementation that processes the derived JVM model and produces the respective java code.
    • Field Detail

      • _typeReferences

        @Inject
        @Extension
        protected org.eclipse.xtext.common.types.util.TypeReferences _typeReferences
      • _treeAppendableUtil

        @Inject
        @Extension
        protected TreeAppendableUtil _treeAppendableUtil
      • _jvmTypeExtensions

        @Inject
        @Extension
        protected JvmTypeExtensions _jvmTypeExtensions
      • _loopExtensions

        @Inject
        @Extension
        protected LoopExtensions _loopExtensions
    • Constructor Detail

      • JvmModelGenerator

        public JvmModelGenerator()
    • Method Detail

      • doGenerate

        public void doGenerate​(org.eclipse.emf.ecore.resource.Resource input,
                               org.eclipse.xtext.generator.IFileSystemAccess fsa)
        Specified by:
        doGenerate in interface org.eclipse.xtext.generator.IGenerator
      • _internalDoGenerate

        protected void _internalDoGenerate​(org.eclipse.emf.ecore.EObject obj,
                                           org.eclipse.xtext.generator.IFileSystemAccess fsa)
      • _internalDoGenerate

        protected void _internalDoGenerate​(org.eclipse.xtext.common.types.JvmDeclaredType type,
                                           org.eclipse.xtext.generator.IFileSystemAccess fsa)
      • createImportManager

        protected ImportManager createImportManager​(org.eclipse.xtext.common.types.JvmDeclaredType type)
      • generateType

        public java.lang.CharSequence generateType​(org.eclipse.xtext.common.types.JvmDeclaredType type,
                                                   GeneratorConfig config)
      • memberSeparator

        protected org.eclipse.xtext.xbase.lib.Functions.Function1<? super ITreeAppendable,​? extends ITreeAppendable> memberSeparator()
        Since:
        2.27
      • generateAnnotationsWithSyntheticSuppressWarnings

        @Deprecated
        public ITreeAppendable generateAnnotationsWithSyntheticSuppressWarnings​(org.eclipse.xtext.common.types.JvmDeclaredType it,
                                                                                ITreeAppendable appendable,
                                                                                GeneratorConfig config)
        Deprecated.
        Additional annotations should be created in the JVM model.
      • generateEnumLiteral

        public void generateEnumLiteral​(org.eclipse.xtext.common.types.JvmEnumerationLiteral it,
                                        ITreeAppendable appendable,
                                        GeneratorConfig config)
      • generateAnnotationMethod

        public void generateAnnotationMethod​(org.eclipse.xtext.common.types.JvmOperation it,
                                             ITreeAppendable appendable,
                                             GeneratorConfig config)
      • generateDefaultExpression

        public void generateDefaultExpression​(org.eclipse.xtext.common.types.JvmOperation it,
                                              ITreeAppendable appendable,
                                              GeneratorConfig config)
      • appendCompilationTemplate

        protected void appendCompilationTemplate​(ITreeAppendable appendable,
                                                 org.eclipse.xtext.common.types.JvmIdentifiableElement it)
        Since:
        2.16
      • generateVisibilityModifier

        public ITreeAppendable generateVisibilityModifier​(org.eclipse.xtext.common.types.JvmMember it,
                                                          ITreeAppendable result)
      • javaName

        public java.lang.String javaName​(org.eclipse.xtext.common.types.JvmVisibility visibility)
        Returns the visibility modifier and a space as suffix if not empty
      • generateExtendsClause

        public void generateExtendsClause​(org.eclipse.xtext.common.types.JvmDeclaredType it,
                                          ITreeAppendable appendable,
                                          GeneratorConfig config)
      • generateInitialization

        public void generateInitialization​(org.eclipse.xtext.common.types.JvmField it,
                                           ITreeAppendable appendable,
                                           GeneratorConfig config)
      • generateTypeParameterDeclaration

        public void generateTypeParameterDeclaration​(org.eclipse.xtext.common.types.JvmTypeParameterDeclarator it,
                                                     ITreeAppendable appendable,
                                                     GeneratorConfig config)
      • generateTypeParameterDeclaration

        public void generateTypeParameterDeclaration​(org.eclipse.xtext.common.types.JvmTypeParameter it,
                                                     ITreeAppendable appendable,
                                                     GeneratorConfig config)
      • generateTypeParameterConstraints

        public void generateTypeParameterConstraints​(org.eclipse.xtext.common.types.JvmTypeParameter it,
                                                     ITreeAppendable appendable,
                                                     GeneratorConfig config)
      • generateThrowsClause

        public void generateThrowsClause​(org.eclipse.xtext.common.types.JvmExecutable it,
                                         ITreeAppendable appendable,
                                         GeneratorConfig config)
      • generateParameters

        public void generateParameters​(org.eclipse.xtext.common.types.JvmExecutable it,
                                       ITreeAppendable appendable,
                                       GeneratorConfig config)
      • generateParameter

        public void generateParameter​(org.eclipse.xtext.common.types.JvmFormalParameter it,
                                      ITreeAppendable appendable,
                                      boolean vararg,
                                      GeneratorConfig config)
      • hasBody

        public boolean hasBody​(org.eclipse.xtext.common.types.JvmExecutable it)
      • generateExecutableBody

        public void generateExecutableBody​(org.eclipse.xtext.common.types.JvmExecutable op,
                                           ITreeAppendable appendable,
                                           GeneratorConfig config)
      • assignThisAndSuper

        public void assignThisAndSuper​(ITreeAppendable b,
                                       org.eclipse.xtext.common.types.JvmDeclaredType declaredType,
                                       GeneratorConfig config)
      • reassignThisType

        protected java.lang.String reassignThisType​(ITreeAppendable b,
                                                    org.eclipse.xtext.common.types.JvmDeclaredType declaredType)
      • generateBodyWithIssues

        public ITreeAppendable generateBodyWithIssues​(org.eclipse.xtext.common.types.JvmExecutable op,
                                                      ITreeAppendable appendable,
                                                      java.lang.Iterable<org.eclipse.xtext.validation.Issue> errors)
        Since:
        2.16
      • generateBodyWithIssues

        public ITreeAppendable generateBodyWithIssues​(ITreeAppendable appendable,
                                                      java.lang.Iterable<org.eclipse.xtext.validation.Issue> errors)
      • doConvertToJavaString

        protected java.lang.String doConvertToJavaString​(java.lang.String input)
        Convert a given input string to a Java string. Non-ascii characters will be replaced by a unicode escape sequence by default.
      • generateFileHeader

        public void generateFileHeader​(org.eclipse.xtext.common.types.JvmDeclaredType it,
                                       ITreeAppendable appendable,
                                       GeneratorConfig config)
      • addJavaDocImports

        public void addJavaDocImports​(org.eclipse.emf.ecore.EObject it,
                                      ITreeAppendable appendable,
                                      java.util.List<org.eclipse.xtext.nodemodel.INode> documentationNodes)
      • generateDocumentation

        protected ITreeAppendable generateDocumentation​(java.lang.String text,
                                                        java.util.List<org.eclipse.xtext.nodemodel.INode> documentationNodes,
                                                        ITreeAppendable appendable,
                                                        GeneratorConfig config)
      • generateAnnotations

        public void generateAnnotations​(java.lang.Iterable<org.eclipse.xtext.common.types.JvmAnnotationReference> annotations,
                                        ITreeAppendable appendable,
                                        boolean withLineBreak,
                                        GeneratorConfig config)
      • generateAnnotation

        public void generateAnnotation​(org.eclipse.xtext.common.types.JvmAnnotationReference it,
                                       ITreeAppendable appendable,
                                       GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmAnnotationAnnotationValue value,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmShortAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmIntAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmLongAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmByteAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmDoubleAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmFloatAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmCharAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmStringAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmTypeAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmEnumAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmBooleanAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • _toJavaLiteral

        protected void _toJavaLiteral​(org.eclipse.xtext.common.types.JvmCustomAnnotationValue it,
                                      ITreeAppendable appendable,
                                      GeneratorConfig config)
      • containerType

        public org.eclipse.xtext.common.types.JvmGenericType containerType​(org.eclipse.emf.ecore.EObject context)
      • makeJavaIdentifier

        protected java.lang.String makeJavaIdentifier​(java.lang.String name)
      • _getMembersToBeCompiled

        protected java.lang.Iterable<org.eclipse.xtext.common.types.JvmMember> _getMembersToBeCompiled​(org.eclipse.xtext.common.types.JvmEnumerationType type)
      • _getMembersToBeCompiled

        protected java.lang.Iterable<org.eclipse.xtext.common.types.JvmMember> _getMembersToBeCompiled​(org.eclipse.xtext.common.types.JvmDeclaredType it)
      • _getMembersToBeCompiled

        protected java.lang.Iterable<org.eclipse.xtext.common.types.JvmMember> _getMembersToBeCompiled​(org.eclipse.xtext.common.types.JvmGenericType it)
      • getSourceElements

        protected java.util.Set<org.eclipse.emf.ecore.EObject> getSourceElements​(org.eclipse.emf.ecore.EObject jvmElement)
      • internalDoGenerate

        public void internalDoGenerate​(org.eclipse.emf.ecore.EObject type,
                                       org.eclipse.xtext.generator.IFileSystemAccess fsa)
      • toJavaLiteral

        public void toJavaLiteral​(org.eclipse.xtext.common.types.JvmAnnotationValue value,
                                  ITreeAppendable appendable,
                                  GeneratorConfig config)
      • getMembersToBeCompiled

        public java.lang.Iterable<org.eclipse.xtext.common.types.JvmMember> getMembersToBeCompiled​(org.eclipse.xtext.common.types.JvmDeclaredType type)