Interface MutableTypeDeclaration
-
- All Superinterfaces:
AnnotationTarget,Declaration,Element,MemberDeclaration,MutableAnnotationTarget,MutableDeclaration,MutableElement,MutableMemberDeclaration,MutableNamedElement,NamedElement,Type,TypeDeclaration
- All Known Subinterfaces:
MutableAnnotationTypeDeclaration,MutableClassDeclaration,MutableEnumerationTypeDeclaration,MutableInterfaceDeclaration
@Beta public interface MutableTypeDeclaration extends MutableMemberDeclaration, TypeDeclaration
A mutable type declaration.- Noimplement:
- This interface is not intended to be implemented by clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MutableConstructorDeclarationaddConstructor(org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableConstructorDeclaration> initializer)Adds a new constructor to this type declaration.MutableFieldDeclarationaddField(java.lang.String name, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableFieldDeclaration> initializer)Adds a new field with the given name.MutableMethodDeclarationaddMethod(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.MutableConstructorDeclarationfindDeclaredConstructor(TypeReference... parameterTypes)MutableFieldDeclarationfindDeclaredField(java.lang.String name)MutableMethodDeclarationfindDeclaredMethod(java.lang.String name, TypeReference... parameterTypes)MutableTypeDeclarationfindDeclaredType(java.lang.String name)java.lang.Iterable<? extends MutableAnnotationTypeDeclaration>getDeclaredAnnotationTypes()java.lang.Iterable<? extends MutableClassDeclaration>getDeclaredClasses()java.lang.Iterable<? extends MutableConstructorDeclaration>getDeclaredConstructors()java.lang.Iterable<? extends MutableEnumerationTypeDeclaration>getDeclaredEnumerationTypes()java.lang.Iterable<? extends MutableFieldDeclaration>getDeclaredFields()java.lang.Iterable<? extends MutableInterfaceDeclaration>getDeclaredInterfaces()java.lang.Iterable<? extends MutableMemberDeclaration>getDeclaredMembers()java.lang.Iterable<? extends MutableMethodDeclaration>getDeclaredMethods()java.lang.Iterable<? extends MutableTypeDeclaration>getDeclaredTypes()voidremove()It is not possible to remove a type.voidsetSimpleName(java.lang.String simpleName)It is not possible to rename a type.-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.AnnotationTarget
findAnnotation, getAnnotations
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MemberDeclaration
getDocComment, getModifiers, getVisibility, isDeprecated
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableAnnotationTarget
addAnnotation, removeAnnotation
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableDeclaration
markAsRead
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableMemberDeclaration
getDeclaringType, setDeprecated, setDocComment, setVisibility
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.NamedElement
getCompilationUnit, getSimpleName
-
Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.Type
getQualifiedName, isAssignableFrom
-
-
-
-
Method Detail
-
getDeclaredMembers
java.lang.Iterable<? extends MutableMemberDeclaration> getDeclaredMembers()
- Specified by:
getDeclaredMembersin interfaceTypeDeclaration- Returns:
- the members directly declared and contained in the type declaration
-
getDeclaredMethods
java.lang.Iterable<? extends MutableMethodDeclaration> getDeclaredMethods()
- Specified by:
getDeclaredMethodsin interfaceTypeDeclaration- Returns:
- the methods directly declared and contained in the type declaration
-
getDeclaredFields
java.lang.Iterable<? extends MutableFieldDeclaration> getDeclaredFields()
- Specified by:
getDeclaredFieldsin interfaceTypeDeclaration- Returns:
- the fields directly declared and contained in the type declaration
-
getDeclaredConstructors
java.lang.Iterable<? extends MutableConstructorDeclaration> getDeclaredConstructors()
- Specified by:
getDeclaredConstructorsin interfaceTypeDeclaration- Returns:
- the constructors directly declared and contained in the type declaration
-
getDeclaredClasses
java.lang.Iterable<? extends MutableClassDeclaration> getDeclaredClasses()
- Specified by:
getDeclaredClassesin interfaceTypeDeclaration- Returns:
- the classes directly declared and contained in the type declaration
-
getDeclaredInterfaces
java.lang.Iterable<? extends MutableInterfaceDeclaration> getDeclaredInterfaces()
- Specified by:
getDeclaredInterfacesin interfaceTypeDeclaration- Returns:
- the interfaces directly declared and contained in the type declaration
-
getDeclaredEnumerationTypes
java.lang.Iterable<? extends MutableEnumerationTypeDeclaration> getDeclaredEnumerationTypes()
- Specified by:
getDeclaredEnumerationTypesin interfaceTypeDeclaration- Returns:
- the enumeration types directly declared and contained in this type declaration
- Since:
- 2.8
-
getDeclaredAnnotationTypes
java.lang.Iterable<? extends MutableAnnotationTypeDeclaration> getDeclaredAnnotationTypes()
- Specified by:
getDeclaredAnnotationTypesin interfaceTypeDeclaration- Returns:
- the annotation types directly declared and contained in this type declaration
- Since:
- 2.8
-
getDeclaredTypes
java.lang.Iterable<? extends MutableTypeDeclaration> getDeclaredTypes()
- Specified by:
getDeclaredTypesin interfaceTypeDeclaration- Returns:
- the types directly declared and contained in this type declaration
- Since:
- 2.8
-
findDeclaredField
MutableFieldDeclaration findDeclaredField(java.lang.String name)
- Specified by:
findDeclaredFieldin interfaceTypeDeclaration- Parameters:
name- of the feature- Returns:
- the declared field with the given name or
nullof no such field exists.
-
findDeclaredType
MutableTypeDeclaration findDeclaredType(java.lang.String name)
- Specified by:
findDeclaredTypein interfaceTypeDeclaration- Parameters:
name- of the nested type- Returns:
- the declared, nested type with the given name or
nullof no such type exists. - Since:
- 2.8
-
findDeclaredMethod
MutableMethodDeclaration findDeclaredMethod(java.lang.String name, TypeReference... parameterTypes)
- Specified by:
findDeclaredMethodin interfaceTypeDeclaration- Parameters:
name- of the methodparameterTypes- - the types of the method- Returns:
- the declared method with the given name and the specified parameter types or
nullif no such method exists.
-
findDeclaredConstructor
MutableConstructorDeclaration findDeclaredConstructor(TypeReference... parameterTypes)
- Specified by:
findDeclaredConstructorin interfaceTypeDeclaration- Parameters:
parameterTypes- - the parameter types of the constructor- Returns:
- the declared constructor with the exact same parameter types or
nullif no such constructors 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 notnullinitializer- a callback for further initialization of the created field, must be notnull- Returns:
- the created field declaration
- Throws:
java.lang.UnsupportedOperationException- if the underlying type declaration is not capable of containing methods.java.lang.IllegalArgumentException- if thenameis not a valid java identifier or theinitializerisnull
-
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 methodinitializer- 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 thenameis not a valid java identifier or theinitializerisnull
-
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 theinitializerisnull
-
setSimpleName
void setSimpleName(java.lang.String simpleName)
It is not possible to rename a type.- Specified by:
setSimpleNamein interfaceMutableNamedElement- Parameters:
simpleName- the simple name of this element, must not benull- Throws:
java.lang.UnsupportedOperationException- always
-
remove
void remove()
It is not possible to remove a type.- Specified by:
removein interfaceMutableElement- Throws:
java.lang.UnsupportedOperationException- always
-
-