Class CompilationUnit<T extends TypeDeclaration>

java.lang.Object
io.spring.initializr.generator.language.CompilationUnit<T>
Type Parameters:
T - the concrete type declaration supported by the compilation unit
Direct Known Subclasses:
GroovyCompilationUnit, JavaCompilationUnit, KotlinCompilationUnit

public abstract class CompilationUnit<T extends TypeDeclaration> extends Object
A compilation unit that represents an individual source file.
Author:
Andy Wilkinson
  • Constructor Details

    • CompilationUnit

      public CompilationUnit(String packageName, String name)
      Create a new instance with the package to use and the name of the type.
      Parameters:
      packageName - the package in which the source file should be located
      name - the name of the file
  • Method Details

    • getPackageName

      public String getPackageName()
      Return the package name in which the file should reside.
      Returns:
      the package name
    • getName

      public String getName()
      Return the name of the source file.
      Returns:
      the name of the source file
    • createTypeDeclaration

      public T createTypeDeclaration(String name)
    • getTypeDeclarations

      public List<T> getTypeDeclarations()
    • doCreateTypeDeclaration

      protected abstract T doCreateTypeDeclaration(String name)