|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.tools.ForwardingJavaFileManager<M>
com.sun.tools.javac.api.WrappingJavaFileManager<M>
M - the type of file manager wrapped to by this objectpublic class WrappingJavaFileManager<M extends JavaFileManager>
Wraps all calls to a given file manager. Subclasses of this class might override some of these methods and might also provide additional fields and methods.
This class might be moved to javax.tools in a future
release.
This is NOT part of any API supported by Sun Microsystems. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface javax.tools.JavaFileManager |
|---|
JavaFileManager.Location |
| Field Summary |
|---|
| Fields inherited from class javax.tools.ForwardingJavaFileManager |
|---|
fileManager |
| Constructor Summary | |
|---|---|
protected |
WrappingJavaFileManager(M fileManager)
Creates a new instance of WrappingJavaFileManager. |
| Method Summary | |
|---|---|
FileObject |
getFileForInput(JavaFileManager.Location location,
java.lang.String packageName,
java.lang.String relativeName)
Gets a file object for input representing the specified relative name in the specified package in the given location. |
FileObject |
getFileForOutput(JavaFileManager.Location location,
java.lang.String packageName,
java.lang.String relativeName,
FileObject sibling)
Gets a file object for output representing the specified relative name in the specified package in the given location. |
JavaFileObject |
getJavaFileForInput(JavaFileManager.Location location,
java.lang.String className,
JavaFileObject.Kind kind)
Gets a file object for input representing the specified class of the specified kind in the given location. |
JavaFileObject |
getJavaFileForOutput(JavaFileManager.Location location,
java.lang.String className,
JavaFileObject.Kind kind,
FileObject sibling)
Gets a file object for output representing the specified class of the specified kind in the given location. |
java.lang.String |
inferBinaryName(JavaFileManager.Location location,
JavaFileObject file)
Infers a binary name of a file object based on a location. |
java.lang.Iterable<JavaFileObject> |
list(JavaFileManager.Location location,
java.lang.String packageName,
java.util.Set<JavaFileObject.Kind> kinds,
boolean recurse)
Lists all file objects matching the given criteria in the given location. |
protected FileObject |
unwrap(FileObject fileObject)
This implementation returns the given file object. |
protected JavaFileObject |
unwrap(JavaFileObject fileObject)
This implementation forwards to unwrap(FileObject). |
protected java.net.URI |
unwrap(java.net.URI uri)
This implementation returns the given URI. |
protected FileObject |
wrap(FileObject fileObject)
This implementation returns the given file object. |
protected java.lang.Iterable<JavaFileObject> |
wrap(java.lang.Iterable<JavaFileObject> fileObjects)
This implementation maps the given list of file objects by calling wrap on each. |
protected JavaFileObject |
wrap(JavaFileObject fileObject)
This implementation forwards to wrap(FileObject). |
| Methods inherited from class javax.tools.ForwardingJavaFileManager |
|---|
close, flush, getClassLoader, handleOption, hasLocation, isSameFile, isSupportedOption |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected WrappingJavaFileManager(M fileManager)
fileManager - file manager to be wrapped| Method Detail |
|---|
protected FileObject wrap(FileObject fileObject)
fileObject - a file objectprotected JavaFileObject wrap(JavaFileObject fileObject)
wrap(FileObject).
Subclasses may override this behavior.
fileObject - a file object
java.lang.ClassCastException - if the file object returned from the
forwarded call is not a subtype of JavaFileObjectprotected FileObject unwrap(FileObject fileObject)
fileObject - a file objectprotected JavaFileObject unwrap(JavaFileObject fileObject)
unwrap(FileObject).
Subclasses may override this behavior.
fileObject - a file object
java.lang.ClassCastException - if the file object returned from the
forwarded call is not a subtype of JavaFileObjectprotected java.lang.Iterable<JavaFileObject> wrap(java.lang.Iterable<JavaFileObject> fileObjects)
fileObjects - a list of file objects
protected java.net.URI unwrap(java.net.URI uri)
uri - a URI
public java.lang.Iterable<JavaFileObject> list(JavaFileManager.Location location,
java.lang.String packageName,
java.util.Set<JavaFileObject.Kind> kinds,
boolean recurse)
throws java.io.IOException
JavaFileManagerNote: even if the given location is unknown to this file
manager, it may not return null. Also, an unknown
location may not cause an exception.
list in interface JavaFileManagerlist in class ForwardingJavaFileManager<M extends JavaFileManager>location - a locationpackageName - a package namekinds - return objects only of these kindsrecurse - if true include "subpackages"
java.lang.IllegalStateException - if JavaFileManager.close() has been called
and this file manager cannot be reopened
java.io.IOException - if an I/O error occurred, or if JavaFileManager.close() has been called and this file manager cannot be
reopened
public java.lang.String inferBinaryName(JavaFileManager.Location location,
JavaFileObject file)
JavaFileManager
inferBinaryName in interface JavaFileManagerinferBinaryName in class ForwardingJavaFileManager<M extends JavaFileManager>location - a locationfile - a file object
null the file object is not
found in the given location
java.lang.IllegalStateException - if JavaFileManager.close() has been called
and this file manager cannot be reopened
public JavaFileObject getJavaFileForInput(JavaFileManager.Location location,
java.lang.String className,
JavaFileObject.Kind kind)
throws java.io.IOException
JavaFileManager
getJavaFileForInput in interface JavaFileManagergetJavaFileForInput in class ForwardingJavaFileManager<M extends JavaFileManager>location - a locationclassName - the name of a classkind - the kind of file, must be one of SOURCE or CLASS
null if the
file does not exist
java.lang.IllegalArgumentException - if the location is not known
to this file manager and the file manager does not support
unknown locations, or if the kind is not valid
java.lang.UnsupportedOperationException
java.lang.IllegalStateException - if JavaFileManager.close() has been called
and this file manager cannot be reopened
java.io.IOException - if an I/O error occurred, or if JavaFileManager.close() has been called and this file manager cannot be
reopened
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location,
java.lang.String className,
JavaFileObject.Kind kind,
FileObject sibling)
throws java.io.IOException
JavaFileManagerOptionally, this file manager might consider the sibling as a hint for where to place the output. The exact semantics of this hint is unspecified. Sun's compiler, javac, for example, will place class files in the same directories as originating source files unless a class file output directory is provided. To facilitate this behavior, javac might provide the originating source file as sibling when calling this method.
getJavaFileForOutput in interface JavaFileManagergetJavaFileForOutput in class ForwardingJavaFileManager<M extends JavaFileManager>location - a locationclassName - the name of a classkind - the kind of file, must be one of SOURCE or CLASSsibling - a file object to be used as hint for placement;
might be null
java.lang.IllegalArgumentException - if sibling is not known to
this file manager, or if the location is not known to this file
manager and the file manager does not support unknown
locations, or if the kind is not valid
java.lang.UnsupportedOperationException
java.lang.IllegalStateException - JavaFileManager.close() has been called
and this file manager cannot be reopened
java.io.IOException - if an I/O error occurred, or if JavaFileManager.close() has been called and this file manager cannot be
reopened
public FileObject getFileForInput(JavaFileManager.Location location,
java.lang.String packageName,
java.lang.String relativeName)
throws java.io.IOException
JavaFileManagerIf the returned object represents a source or class file, it must be an instance
of JavaFileObject.
Informally, the file object returned by this method is located in the concatenation of the location, package name, and relative name. For example, to locate the properties file "resources/compiler.properties" in the package "com.sun.tools.javac" in the SOURCE_PATH location, this method might be called like so:
getFileForInput(SOURCE_PATH, "com.sun.tools.javac", "resources/compiler.properties");
If the call was executed on Windows, with SOURCE_PATH set to
"C:\Documents and Settings\UncleBob\src\share\classes",
a valid result would be a file object representing the file
"C:\Documents and Settings\UncleBob\src\share\classes\com\sun\tools\javac\resources\compiler.properties".
getFileForInput in interface JavaFileManagergetFileForInput in class ForwardingJavaFileManager<M extends JavaFileManager>location - a locationpackageName - a package namerelativeName - a relative name
null if the file
does not exist
java.lang.IllegalArgumentException - if the location is not known
to this file manager and the file manager does not support
unknown locations, or if relativeName is not valid
java.lang.IllegalStateException - if JavaFileManager.close() has been called
and this file manager cannot be reopened
java.io.IOException - if an I/O error occurred, or if JavaFileManager.close() has been called and this file manager cannot be
reopened
public FileObject getFileForOutput(JavaFileManager.Location location,
java.lang.String packageName,
java.lang.String relativeName,
FileObject sibling)
throws java.io.IOException
JavaFileManagerOptionally, this file manager might consider the sibling as a hint for where to place the output. The exact semantics of this hint is unspecified. Sun's compiler, javac, for example, will place class files in the same directories as originating source files unless a class file output directory is provided. To facilitate this behavior, javac might provide the originating source file as sibling when calling this method.
If the returned object represents a source or class file, it must be an instance
of JavaFileObject.
Informally, the file object returned by this method is
located in the concatenation of the location, package name, and
relative name or next to the sibling argument. See getFileForInput for an example.
getFileForOutput in interface JavaFileManagergetFileForOutput in class ForwardingJavaFileManager<M extends JavaFileManager>location - a locationpackageName - a package namerelativeName - a relative namesibling - a file object to be used as hint for placement;
might be null
java.lang.IllegalArgumentException - if sibling is not known to
this file manager, or if the location is not known to this file
manager and the file manager does not support unknown
locations, or if relativeName is not valid
java.lang.IllegalStateException - if JavaFileManager.close() has been called
and this file manager cannot be reopened
java.io.IOException - if an I/O error occurred, or if JavaFileManager.close() has been called and this file manager cannot be
reopened
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||