public final class JavaFile extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
JavaFile.Builder |
| 限定符和类型 | 字段和说明 |
|---|---|
CodeBlock |
fileComment |
String |
packageName |
boolean |
skipJavaLangImports |
TypeSpec |
typeSpec |
| 限定符和类型 | 方法和说明 |
|---|---|
static JavaFile.Builder |
builder(String packageName,
TypeSpec typeSpec) |
boolean |
equals(Object o) |
int |
hashCode() |
JavaFile.Builder |
toBuilder() |
JavaFileObject |
toJavaFileObject() |
String |
toString() |
void |
writeTo(Appendable out) |
void |
writeTo(File directory)
Writes this to
directory as UTF-8 using the standard directory structure. |
void |
writeTo(Filer filer)
Writes this to
filer. |
void |
writeTo(Path directory)
Writes this to
directory as UTF-8 using the standard directory structure. |
void |
writeTo(Path directory,
Charset charset)
Writes this to
directory with the provided charset using the standard directory
structure. |
File |
writeToFile(File directory)
Writes this to
directory as UTF-8 using the standard directory structure. |
Path |
writeToPath(Path directory)
Writes this to
directory as UTF-8 using the standard directory structure. |
Path |
writeToPath(Path directory,
Charset charset)
Writes this to
directory with the provided charset using the standard directory
structure. |
public final CodeBlock fileComment
public final String packageName
public final TypeSpec typeSpec
public final boolean skipJavaLangImports
public void writeTo(Appendable out) throws IOException
IOExceptionpublic void writeTo(Path directory) throws IOException
directory as UTF-8 using the standard directory structure.IOExceptionpublic void writeTo(Path directory, Charset charset) throws IOException
directory with the provided charset using the standard directory
structure.IOExceptionpublic Path writeToPath(Path directory) throws IOException
directory as UTF-8 using the standard directory structure.
Returns the Path instance to which source is actually written.IOExceptionpublic Path writeToPath(Path directory, Charset charset) throws IOException
directory with the provided charset using the standard directory
structure.
Returns the Path instance to which source is actually written.IOExceptionpublic void writeTo(File directory) throws IOException
directory as UTF-8 using the standard directory structure.IOExceptionpublic File writeToFile(File directory) throws IOException
directory as UTF-8 using the standard directory structure.
Returns the File instance to which source is actually written.IOExceptionpublic void writeTo(Filer filer) throws IOException
filer.IOExceptionpublic JavaFileObject toJavaFileObject()
public static JavaFile.Builder builder(String packageName, TypeSpec typeSpec)
public JavaFile.Builder toBuilder()
Copyright © 2025 fossc. All rights reserved.