Module org.eclipse.xtend.lib.macro
Interface MutableTypeDeclaration
- All Superinterfaces:
AnnotationTarget,Declaration,Element,MemberDeclaration,MutableAnnotationTarget,MutableDeclaration,MutableElement,MutableMemberDeclaration,MutableNamedElement,NamedElement,Type,TypeDeclaration
- All Known Subinterfaces:
MutableAnnotationTypeDeclaration,MutableClassDeclaration,MutableEnumerationTypeDeclaration,MutableInterfaceDeclaration
A mutable type declaration.
- Author:
- Sven Efftinge
-
Method Summary
Modifier and TypeMethodDescriptionaddConstructor(org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableConstructorDeclaration> initializer) Adds a new constructor to this type declaration.addField(String name, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableFieldDeclaration> initializer) Adds a new field with the given name.addMethod(String name, org.eclipse.xtext.xbase.lib.Procedures.Procedure1<MutableMethodDeclaration> initializer) Adds a new method with the given name to this type declaration.findDeclaredConstructor(TypeReference... parameterTypes) findDeclaredField(String name) findDeclaredMethod(String name, TypeReference... parameterTypes) findDeclaredType(String name) Iterable<? extends MutableAnnotationTypeDeclaration> Iterable<? extends MutableClassDeclaration> Iterable<? extends MutableConstructorDeclaration> Iterable<? extends MutableEnumerationTypeDeclaration> Iterable<? extends MutableFieldDeclaration> Iterable<? extends MutableInterfaceDeclaration> Iterable<? extends MutableMemberDeclaration> Iterable<? extends MutableMethodDeclaration> Iterable<? extends MutableTypeDeclaration> voidremove()It is not possible to remove a type.voidsetSimpleName(String simpleName) It is not possible to rename a type.Methods inherited from interface org.eclipse.xtend.lib.macro.declaration.AnnotationTarget
findAnnotation, getAnnotationsMethods inherited from interface org.eclipse.xtend.lib.macro.declaration.MemberDeclaration
getDocComment, getModifiers, getVisibility, isDeprecatedMethods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableAnnotationTarget
addAnnotation, removeAnnotationMethods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableDeclaration
markAsReadMethods inherited from interface org.eclipse.xtend.lib.macro.declaration.MutableMemberDeclaration
getDeclaringType, setDeprecated, setDocComment, setVisibilityMethods inherited from interface org.eclipse.xtend.lib.macro.declaration.NamedElement
getCompilationUnit, getSimpleNameMethods inherited from interface org.eclipse.xtend.lib.macro.declaration.Type
getQualifiedName, isAssignableFrom
-
Method Details
-
getDeclaredMembers
Iterable<? extends MutableMemberDeclaration> getDeclaredMembers()- Specified by:
getDeclaredMembersin interfaceTypeDeclaration- Returns:
- the members directly declared and contained in the type declaration
-
getDeclaredMethods
Iterable<? extends MutableMethodDeclaration> getDeclaredMethods()- Specified by:
getDeclaredMethodsin interfaceTypeDeclaration- Returns:
- the methods directly declared and contained in the type declaration
-
getDeclaredFields
Iterable<? extends MutableFieldDeclaration> getDeclaredFields()- Specified by:
getDeclaredFieldsin interfaceTypeDeclaration- Returns:
- the fields directly declared and contained in the type declaration
-
getDeclaredConstructors
Iterable<? extends MutableConstructorDeclaration> getDeclaredConstructors()- Specified by:
getDeclaredConstructorsin interfaceTypeDeclaration- Returns:
- the constructors directly declared and contained in the type declaration
-
getDeclaredClasses
Iterable<? extends MutableClassDeclaration> getDeclaredClasses()- Specified by:
getDeclaredClassesin interfaceTypeDeclaration- Returns:
- the classes directly declared and contained in the type declaration
-
getDeclaredInterfaces
Iterable<? extends MutableInterfaceDeclaration> getDeclaredInterfaces()- Specified by:
getDeclaredInterfacesin interfaceTypeDeclaration- Returns:
- the interfaces directly declared and contained in the type declaration
-
getDeclaredEnumerationTypes
Iterable<? extends MutableEnumerationTypeDeclaration> getDeclaredEnumerationTypes()- Specified by:
getDeclaredEnumerationTypesin interfaceTypeDeclaration- Returns:
- the enumeration types directly declared and contained in this type declaration
- Since:
- 2.8
-
getDeclaredAnnotationTypes
Iterable<? extends MutableAnnotationTypeDeclaration> getDeclaredAnnotationTypes()- Specified by:
getDeclaredAnnotationTypesin interfaceTypeDeclaration- Returns:
- the annotation types directly declared and contained in this type declaration
- Since:
- 2.8
-
getDeclaredTypes
Iterable<? extends MutableTypeDeclaration> getDeclaredTypes()- Specified by:
getDeclaredTypesin interfaceTypeDeclaration- Returns:
- the types directly declared and contained in this type declaration
- Since:
- 2.8
-
findDeclaredField
- Specified by:
findDeclaredFieldin interfaceTypeDeclaration- Parameters:
name- of the feature- Returns:
- the declared field with the given name or
nullof no such field exists.
-
findDeclaredType
- 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
- 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
- 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(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:
UnsupportedOperationException- if the underlying type declaration is not capable of containing methods.IllegalArgumentException- if thenameis not a valid java identifier or theinitializerisnull
-
addMethod
MutableMethodDeclaration addMethod(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:
UnsupportedOperationException- if the underlying type declaration is not capable of containing methods.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:
UnsupportedOperationException- if the underlying type declaration is not capable of containing constructors.IllegalArgumentException- if theinitializerisnull
-
setSimpleName
It is not possible to rename a type.- Specified by:
setSimpleNamein interfaceMutableNamedElement- Parameters:
simpleName- the simple name of this element, must not benull- Throws:
UnsupportedOperationException- always
-
remove
void remove()It is not possible to remove a type.- Specified by:
removein interfaceMutableElement- Throws:
UnsupportedOperationException- always
-