Class JavaFile

java.lang.Object
io.micronaut.sourcegen.javapoet.JavaFile

public final class JavaFile extends Object
A Java file containing a single top level class.
  • Field Details

    • fileComment

      public final CodeBlock fileComment
    • packageName

      public final String packageName
    • typeSpec

      public final TypeSpec typeSpec
    • skipJavaLangImports

      public final boolean skipJavaLangImports
  • Method Details

    • writeTo

      public void writeTo(Appendable out) throws IOException
      Throws:
      IOException
    • writeTo

      public void writeTo(Path directory) throws IOException
      Writes this to directory as UTF-8 using the standard directory structure.
      Throws:
      IOException
    • writeTo

      public void writeTo(Path directory, Charset charset) throws IOException
      Writes this to directory with the provided charset using the standard directory structure.
      Throws:
      IOException
    • writeToPath

      public Path writeToPath(Path directory) throws IOException
      Writes this to directory as UTF-8 using the standard directory structure. Returns the Path instance to which source is actually written.
      Throws:
      IOException
    • writeToPath

      public Path writeToPath(Path directory, Charset charset) throws IOException
      Writes this to directory with the provided charset using the standard directory structure. Returns the Path instance to which source is actually written.
      Throws:
      IOException
    • writeTo

      public void writeTo(File directory) throws IOException
      Writes this to directory as UTF-8 using the standard directory structure.
      Throws:
      IOException
    • writeToFile

      public File writeToFile(File directory) throws IOException
      Writes this to directory as UTF-8 using the standard directory structure. Returns the File instance to which source is actually written.
      Throws:
      IOException
    • writeTo

      public void writeTo(Filer filer) throws IOException
      Writes this to filer.
      Throws:
      IOException
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toJavaFileObject

      public JavaFileObject toJavaFileObject()
    • builder

      public static JavaFile.Builder builder(String packageName, TypeSpec typeSpec)
    • toBuilder

      public JavaFile.Builder toBuilder()