public final class JavaFileObjects
extends java.lang.Object
JavaFileObject instances.| Modifier and Type | Method and Description |
|---|---|
static javax.tools.JavaFileObject |
forResource(java.lang.String resourceName)
Returns a
JavaFileObject for the class path resource with the given
resourceName. |
static javax.tools.JavaFileObject |
forResource(java.net.URL resourceUrl)
Returns a
JavaFileObject for the resource at the given URL. |
static javax.tools.JavaFileObject |
forSourceLines(java.lang.String fullyQualifiedName,
java.lang.Iterable<java.lang.String> lines)
An overload of
#forSourceLines that takes an Iterable<String>. |
static javax.tools.JavaFileObject |
forSourceLines(java.lang.String fullyQualifiedName,
java.lang.String... lines)
Behaves exactly like
forSourceString(java.lang.String, java.lang.String), but joins lines so that multi-line source
strings may omit the newline characters. |
static javax.tools.JavaFileObject |
forSourceString(java.lang.String fullyQualifiedName,
java.lang.String source)
Creates a
JavaFileObject with a path corresponding to the fullyQualifiedName
containing the give source. |
public static javax.tools.JavaFileObject forSourceString(java.lang.String fullyQualifiedName,
java.lang.String source)
JavaFileObject with a path corresponding to the fullyQualifiedName
containing the give source. The returned object will always be read-only and have the
JavaFileObject.Kind.SOURCE kind.
Note that this method makes no attempt to verify that the name matches the contents of the source and compilation errors may result if they do not match.
public static javax.tools.JavaFileObject forSourceLines(java.lang.String fullyQualifiedName,
java.lang.String... lines)
forSourceString(java.lang.String, java.lang.String), but joins lines so that multi-line source
strings may omit the newline characters. For example:
JavaFileObjects.forSourceLines("example.HelloWorld",
"package example;",
"",
"final class HelloWorld {",
" void sayHello() {",
" System.out.println(\"hello!\");",
" }",
"}");
public static javax.tools.JavaFileObject forSourceLines(java.lang.String fullyQualifiedName,
java.lang.Iterable<java.lang.String> lines)
#forSourceLines that takes an Iterable<String>.public static javax.tools.JavaFileObject forResource(java.net.URL resourceUrl)
JavaFileObject for the resource at the given URL. The returned object
will always be read-only and the kind is inferred via
the JavaFileObject.Kind.extension.public static javax.tools.JavaFileObject forResource(java.lang.String resourceName)
JavaFileObject for the class path resource with the given
resourceName. This method is equivalent to invoking
forResource(Resources.getResource(resourceName)).Copyright © 2013-2017. All Rights Reserved.