Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/tools/JavaFileObject.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 javax.lang.model.element.NestingKind;28import javax.lang.model.element.Modifier;2930/**31* File abstraction for tools operating on Java™ programming language32* source and class files.33*34* <p>All methods in this interface might throw a SecurityException if35* a security exception occurs.36*37* <p>Unless explicitly allowed, all methods in this interface might38* throw a NullPointerException if given a {@code null} argument.39*40* @author Peter von der Ahé41* @author Jonathan Gibbons42* @see JavaFileManager43* @since 1.644*/45public interface JavaFileObject extends FileObject {4647/**48* Kinds of JavaFileObjects.49*/50enum Kind {51/**52* Source files written in the Java programming language. For53* example, regular files ending with {@code .java}.54*/55SOURCE(".java"),5657/**58* Class files for the Java Virtual Machine. For example,59* regular files ending with {@code .class}.60*/61CLASS(".class"),6263/**64* HTML files. For example, regular files ending with {@code65* .html}.66*/67HTML(".html"),6869/**70* Any other kind.71*/72OTHER("");73/**74* The extension which (by convention) is normally used for75* this kind of file object. If no convention exists, the76* empty string ({@code ""}) is used.77*/78public final String extension;79private Kind(String extension) {80extension.getClass(); // null check81this.extension = extension;82}83};8485/**86* Gets the kind of this file object.87*88* @return the kind89*/90Kind getKind();9192/**93* Checks if this file object is compatible with the specified94* simple name and kind. A simple name is a single identifier95* (not qualified) as defined in96* <cite>The Java™ Language Specification</cite>,97* section 6.2 "Names and Identifiers".98*99* @param simpleName a simple name of a class100* @param kind a kind101* @return {@code true} if this file object is compatible; false102* otherwise103*/104boolean isNameCompatible(String simpleName, Kind kind);105106/**107* Provides a hint about the nesting level of the class108* represented by this file object. This method may return109* {@link NestingKind#MEMBER} to mean110* {@link NestingKind#LOCAL} or {@link NestingKind#ANONYMOUS}.111* If the nesting level is not known or this file object does not112* represent a class file this method returns {@code null}.113*114* @return the nesting kind, or {@code null} if the nesting kind115* is not known116*/117NestingKind getNestingKind();118119/**120* Provides a hint about the access level of the class represented121* by this file object. If the access level is not known or if122* this file object does not represent a class file this method123* returns {@code null}.124*125* @return the access level126*/127Modifier getAccessLevel();128129}130131132