Interface TypeHolderSource<T extends JavaSource<T>>

All Superinterfaces:
TypeHolder<T>
All Known Subinterfaces:
EnumConstantSource.Body, JavaAnnotationSource, JavaClassSource, JavaEnumSource, JavaInterfaceSource, JavaRecordSource

public interface TypeHolderSource<T extends JavaSource<T>> extends TypeHolder<T>
Represents a JavaSource that may declare types.
Author:
George Gastaldi
  • Method Details

    • getNestedTypes

      List<JavaSource<?>> getNestedTypes()
      Return a list containing JavaSource instances for each nested Class declaration found within this. Any modification of returned JavaSource instances will result in modification of the contents contained by this the parent instance.
      Specified by:
      getNestedTypes in interface TypeHolder<T extends JavaSource<T>>
    • getNestedType

      JavaSource<?> getNestedType(String name)
      Description copied from interface: TypeHolder
      Get the JavaType with the given name and return it, otherwise, return null.
      Specified by:
      getNestedType in interface TypeHolder<T extends JavaSource<T>>
    • addNestedType

      <NESTED_TYPE extends JavaSource<?>> NESTED_TYPE addNestedType(Class<NESTED_TYPE> type)
      Creates a nested type in this JavaSource. Any modification of returned JavaSource instances will result in modification of the contents contained by this the parent instance.
    • addNestedType

      <NESTED_TYPE extends JavaSource<?>> NESTED_TYPE addNestedType(String declaration)
      Add a new type declaration to this instance, using the given String as the declaration.

      For example:
      JavaClassSource source = javaClass.addNested("public class InnerClass{}");

    • addNestedType

      <NESTED_TYPE extends JavaSource<?>> NESTED_TYPE addNestedType(NESTED_TYPE type)
      Adds a type as a nested type in this JavaSource. Any modification of returned JavaSource instances will result in modification of the contents contained by this the parent instance.
    • removeNestedType

      T removeNestedType(JavaSource<?> type)
      Remove the nested type instance, if it exists; otherwise, do nothing.