Interface MutableTypeDeclaration

    • Method Detail

      • findDeclaredType

        MutableTypeDeclaration findDeclaredType​(java.lang.String name)
        Specified by:
        findDeclaredType in interface TypeDeclaration
        Parameters:
        name - of the nested type
        Returns:
        the declared, nested type with the given name or null of no such type exists.
        Since:
        2.8
      • findDeclaredMethod

        MutableMethodDeclaration findDeclaredMethod​(java.lang.String name,
                                                    TypeReference... parameterTypes)
        Specified by:
        findDeclaredMethod in interface TypeDeclaration
        Parameters:
        name - of the method
        parameterTypes - - the types of the method
        Returns:
        the declared method with the given name and the specified parameter types or null if no such method exists.
      • addField

        MutableFieldDeclaration addField​(java.lang.String name,
                                         org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableFieldDeclaration> initializer)
        Adds a new field with the given name.
        Parameters:
        name - the name of the field to be added, must be not null
        initializer - a callback for further initialization of the created field, must be not null
        Returns:
        the created field declaration
        Throws:
        java.lang.UnsupportedOperationException - if the underlying type declaration is not capable of containing methods.
        java.lang.IllegalArgumentException - if the name is not a valid java identifier or the initializer is null
      • addMethod

        MutableMethodDeclaration addMethod​(java.lang.String name,
                                           org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableMethodDeclaration> initializer)
        Adds a new method with the given name to this type declaration.
        Parameters:
        name - the name of the method
        initializer - a call back for further initialization of the method
        Returns:
        the created method declaration
        Throws:
        java.lang.UnsupportedOperationException - if the underlying type declaration is not capable of containing methods.
        java.lang.IllegalArgumentException - if the name is not a valid java identifier or the initializer is null
      • addConstructor

        MutableConstructorDeclaration addConstructor​(org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableConstructorDeclaration> initializer)
        Adds a new constructor to this type declaration.
        Parameters:
        initializer - a call back for further initialization of the constructor
        Returns:
        the created constructor declaration
        Throws:
        java.lang.UnsupportedOperationException - if the underlying type declaration is not capable of containing constructors.
        java.lang.IllegalArgumentException - if the initializer is null
      • setSimpleName

        void setSimpleName​(java.lang.String simpleName)
        It is not possible to rename a type.
        Specified by:
        setSimpleName in interface MutableNamedElement
        Parameters:
        simpleName - the simple name of this element, must not be null
        Throws:
        java.lang.UnsupportedOperationException - always
      • remove

        void remove()
        It is not possible to remove a type.
        Specified by:
        remove in interface MutableElement
        Throws:
        java.lang.UnsupportedOperationException - always