Interface TypeHolderSource<T extends JavaSource<T>>
- All Superinterfaces:
TypeHolder<T>
- All Known Subinterfaces:
EnumConstantSource.Body,JavaAnnotationSource,JavaClassSource,JavaEnumSource,JavaInterfaceSource,JavaRecordSource
Represents a
JavaSource that may declare types.- Author:
- George Gastaldi
-
Method Summary
Modifier and TypeMethodDescription<NESTED_TYPE extends JavaSource<?>>
NESTED_TYPEaddNestedType(Class<NESTED_TYPE> type) Creates a nested type in thisJavaSource.<NESTED_TYPE extends JavaSource<?>>
NESTED_TYPEaddNestedType(String declaration) Add a new type declaration to this instance, using the givenStringas the declaration.<NESTED_TYPE extends JavaSource<?>>
NESTED_TYPEaddNestedType(NESTED_TYPE type) Adds a type as a nested type in thisJavaSource.JavaSource<?>getNestedType(String name) Get theJavaTypewith the given name and return it, otherwise, return null.List<JavaSource<?>>removeNestedType(JavaSource<?> type) Remove the nested type instance, if it exists; otherwise, do nothing.Methods inherited from interface org.jboss.forge.roaster.model.TypeHolder
hasNestedType, hasNestedType, hasNestedType
-
Method Details
-
getNestedTypes
List<JavaSource<?>> getNestedTypes()Return a list containingJavaSourceinstances for each nestedClassdeclaration found withinthis. Any modification of returnedJavaSourceinstances will result in modification of the contents contained bythisthe parent instance.- Specified by:
getNestedTypesin interfaceTypeHolder<T extends JavaSource<T>>
-
getNestedType
Description copied from interface:TypeHolderGet theJavaTypewith the given name and return it, otherwise, return null.- Specified by:
getNestedTypein interfaceTypeHolder<T extends JavaSource<T>>
-
addNestedType
Creates a nested type in thisJavaSource. Any modification of returnedJavaSourceinstances will result in modification of the contents contained bythisthe parent instance. -
addNestedType
Add a new type declaration to this instance, using the givenStringas the declaration. For example:
JavaClassSource source = javaClass.addNested("public class InnerClass{}"); -
addNestedType
Adds a type as a nested type in thisJavaSource. Any modification of returnedJavaSourceinstances will result in modification of the contents contained bythisthe parent instance. -
removeNestedType
Remove the nested type instance, if it exists; otherwise, do nothing.
-