Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/tools/ForwardingJavaFileManager.java
38900 views
/*1* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.tools;2627import java.io.IOException;28import java.util.Iterator;29import java.util.Set;30import javax.tools.JavaFileObject.Kind;3132/**33* Forwards calls to a given file manager. Subclasses of this class34* might override some of these methods and might also provide35* additional fields and methods.36*37* @param <M> the kind of file manager forwarded to by this object38* @author Peter von der Ahé39* @since 1.640*/41public class ForwardingJavaFileManager<M extends JavaFileManager> implements JavaFileManager {4243/**44* The file manager which all methods are delegated to.45*/46protected final M fileManager;4748/**49* Creates a new instance of ForwardingJavaFileManager.50* @param fileManager delegate to this file manager51*/52protected ForwardingJavaFileManager(M fileManager) {53fileManager.getClass(); // null check54this.fileManager = fileManager;55}5657/**58* @throws SecurityException {@inheritDoc}59* @throws IllegalStateException {@inheritDoc}60*/61public ClassLoader getClassLoader(Location location) {62return fileManager.getClassLoader(location);63}6465/**66* @throws IOException {@inheritDoc}67* @throws IllegalStateException {@inheritDoc}68*/69public Iterable<JavaFileObject> list(Location location,70String packageName,71Set<Kind> kinds,72boolean recurse)73throws IOException74{75return fileManager.list(location, packageName, kinds, recurse);76}7778/**79* @throws IllegalStateException {@inheritDoc}80*/81public String inferBinaryName(Location location, JavaFileObject file) {82return fileManager.inferBinaryName(location, file);83}8485/**86* @throws IllegalArgumentException {@inheritDoc}87*/88public boolean isSameFile(FileObject a, FileObject b) {89return fileManager.isSameFile(a, b);90}9192/**93* @throws IllegalArgumentException {@inheritDoc}94* @throws IllegalStateException {@inheritDoc}95*/96public boolean handleOption(String current, Iterator<String> remaining) {97return fileManager.handleOption(current, remaining);98}99100public boolean hasLocation(Location location) {101return fileManager.hasLocation(location);102}103104public int isSupportedOption(String option) {105return fileManager.isSupportedOption(option);106}107108/**109* @throws IllegalArgumentException {@inheritDoc}110* @throws IllegalStateException {@inheritDoc}111*/112public JavaFileObject getJavaFileForInput(Location location,113String className,114Kind kind)115throws IOException116{117return fileManager.getJavaFileForInput(location, className, kind);118}119120/**121* @throws IllegalArgumentException {@inheritDoc}122* @throws IllegalStateException {@inheritDoc}123*/124public JavaFileObject getJavaFileForOutput(Location location,125String className,126Kind kind,127FileObject sibling)128throws IOException129{130return fileManager.getJavaFileForOutput(location, className, kind, sibling);131}132133/**134* @throws IllegalArgumentException {@inheritDoc}135* @throws IllegalStateException {@inheritDoc}136*/137public FileObject getFileForInput(Location location,138String packageName,139String relativeName)140throws IOException141{142return fileManager.getFileForInput(location, packageName, relativeName);143}144145/**146* @throws IllegalArgumentException {@inheritDoc}147* @throws IllegalStateException {@inheritDoc}148*/149public FileObject getFileForOutput(Location location,150String packageName,151String relativeName,152FileObject sibling)153throws IOException154{155return fileManager.getFileForOutput(location, packageName, relativeName, sibling);156}157158public void flush() throws IOException {159fileManager.flush();160}161162public void close() throws IOException {163fileManager.close();164}165}166167168