ForwardingJavaFileManager.java revision 0
325N/A/*
325N/A * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Sun designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Sun in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
325N/A * CA 95054 USA or visit www.sun.com if you need additional information or
325N/A * have any questions.
325N/A */
325N/A
325N/Apackage javax.tools;
325N/A
325N/Aimport java.io.IOException;
325N/Aimport java.net.URI;
325N/Aimport java.util.Iterator;
325N/Aimport java.util.Set;
325N/Aimport javax.tools.JavaFileObject.Kind;
325N/A
325N/A/**
325N/A * Forwards calls to a given file manager. Subclasses of this class
325N/A * might override some of these methods and might also provide
325N/A * additional fields and methods.
325N/A *
325N/A * @param <M> the kind of file manager forwarded to by this object
325N/A * @author Peter von der Ah&eacute;
325N/A * @since 1.6
325N/A */
325N/Apublic class ForwardingJavaFileManager<M extends JavaFileManager> implements JavaFileManager {
325N/A
325N/A /**
325N/A * The file manager which all methods are delegated to.
325N/A */
325N/A protected final M fileManager;
325N/A
325N/A /**
325N/A * Creates a new instance of ForwardingJavaFileManager.
325N/A * @param fileManager delegate to this file manager
325N/A */
325N/A protected ForwardingJavaFileManager(M fileManager) {
325N/A fileManager.getClass(); // null check
325N/A this.fileManager = fileManager;
325N/A }
325N/A
325N/A /**
325N/A * @throws SecurityException {@inheritDoc}
325N/A * @throws IllegalStateException {@inheritDoc}
325N/A */
325N/A public ClassLoader getClassLoader(Location location) {
325N/A return fileManager.getClassLoader(location);
325N/A }
325N/A
325N/A /**
325N/A * @throws IOException {@inheritDoc}
325N/A * @throws IllegalStateException {@inheritDoc}
325N/A */
325N/A public Iterable<JavaFileObject> list(Location location,
325N/A String packageName,
325N/A Set<Kind> kinds,
325N/A boolean recurse)
325N/A throws IOException
325N/A {
325N/A return fileManager.list(location, packageName, kinds, recurse);
325N/A }
325N/A
325N/A /**
325N/A * @throws IllegalStateException {@inheritDoc}
325N/A */
325N/A public String inferBinaryName(Location location, JavaFileObject file) {
325N/A return fileManager.inferBinaryName(location, file);
325N/A }
325N/A
325N/A /**
325N/A * @throws IllegalArgumentException {@inheritDoc}
325N/A */
325N/A public boolean isSameFile(FileObject a, FileObject b) {
325N/A return fileManager.isSameFile(a, b);
325N/A }
325N/A
325N/A /**
325N/A * @throws IllegalArgumentException {@inheritDoc}
325N/A * @throws IllegalStateException {@inheritDoc}
325N/A */
325N/A public boolean handleOption(String current, Iterator<String> remaining) {
325N/A return fileManager.handleOption(current, remaining);
325N/A }
325N/A
325N/A public boolean hasLocation(Location location) {
325N/A return fileManager.hasLocation(location);
325N/A }
325N/A
325N/A public int isSupportedOption(String option) {
325N/A return fileManager.isSupportedOption(option);
325N/A }
325N/A
325N/A /**
325N/A * @throws IllegalArgumentException {@inheritDoc}
325N/A * @throws IllegalStateException {@inheritDoc}
325N/A */
325N/A public JavaFileObject getJavaFileForInput(Location location,
325N/A String className,
325N/A Kind kind)
325N/A throws IOException
325N/A {
325N/A return fileManager.getJavaFileForInput(location, className, kind);
325N/A }
325N/A
325N/A /**
325N/A * @throws IllegalArgumentException {@inheritDoc}
325N/A * @throws IllegalStateException {@inheritDoc}
325N/A */
325N/A public JavaFileObject getJavaFileForOutput(Location location,
325N/A String className,
325N/A Kind kind,
325N/A FileObject sibling)
325N/A throws IOException
325N/A {
325N/A return fileManager.getJavaFileForOutput(location, className, kind, sibling);
325N/A }
/**
* @throws IllegalArgumentException {@inheritDoc}
* @throws IllegalStateException {@inheritDoc}
*/
public FileObject getFileForInput(Location location,
String packageName,
String relativeName)
throws IOException
{
return fileManager.getFileForInput(location, packageName, relativeName);
}
/**
* @throws IllegalArgumentException {@inheritDoc}
* @throws IllegalStateException {@inheritDoc}
*/
public FileObject getFileForOutput(Location location,
String packageName,
String relativeName,
FileObject sibling)
throws IOException
{
return fileManager.getFileForOutput(location, packageName, relativeName, sibling);
}
public void flush() throws IOException {
fileManager.flush();
}
public void close() throws IOException {
fileManager.close();
}
}