src/share/classes/javax/tools/JavaFileObject.java

Wed, 13 Apr 2011 11:35:43 -0700

author
jjh
date
Wed, 13 Apr 2011 11:35:43 -0700
changeset 972
694ff82ca68e
parent 554
9d9f26857129
child 1357
c75be5bc5283
permissions
-rw-r--r--

7032975: API files in javax.annotation.processing need to be updated for references to JLS
7032972: API files in javax.tools need to updated for references to JVM Spec with editions/hyperlinks
7032978: API files in javax.tools need to be updated for references to JLS with editions/hyperlinks
Summary: Removed URLs and 'edition' references
Reviewed-by: jjg, darcy

duke@1 1 /*
ohair@554 2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
duke@1 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 4 *
duke@1 5 * This code is free software; you can redistribute it and/or modify it
duke@1 6 * under the terms of the GNU General Public License version 2 only, as
ohair@554 7 * published by the Free Software Foundation. Oracle designates this
duke@1 8 * particular file as subject to the "Classpath" exception as provided
ohair@554 9 * by Oracle in the LICENSE file that accompanied this code.
duke@1 10 *
duke@1 11 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 14 * version 2 for more details (a copy is included in the LICENSE file that
duke@1 15 * accompanied this code).
duke@1 16 *
duke@1 17 * You should have received a copy of the GNU General Public License version
duke@1 18 * 2 along with this work; if not, write to the Free Software Foundation,
duke@1 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 20 *
ohair@554 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 22 * or visit www.oracle.com if you need additional information or have any
ohair@554 23 * questions.
duke@1 24 */
duke@1 25
duke@1 26 package javax.tools;
duke@1 27
duke@1 28 import java.io.IOException;
duke@1 29 import java.io.InputStream;
duke@1 30 import java.io.OutputStream;
duke@1 31 import java.io.Reader;
duke@1 32 import java.io.Writer;
duke@1 33 import java.nio.CharBuffer;
duke@1 34 import javax.lang.model.element.NestingKind;
duke@1 35 import javax.lang.model.element.Modifier;
duke@1 36
duke@1 37 /**
duke@1 38 * File abstraction for tools operating on Java™ programming language
duke@1 39 * source and class files.
duke@1 40 *
duke@1 41 * <p>All methods in this interface might throw a SecurityException if
duke@1 42 * a security exception occurs.
duke@1 43 *
duke@1 44 * <p>Unless explicitly allowed, all methods in this interface might
duke@1 45 * throw a NullPointerException if given a {@code null} argument.
duke@1 46 *
duke@1 47 * @author Peter von der Ah&eacute;
duke@1 48 * @author Jonathan Gibbons
duke@1 49 * @see JavaFileManager
duke@1 50 * @since 1.6
duke@1 51 */
duke@1 52 public interface JavaFileObject extends FileObject {
duke@1 53
duke@1 54 /**
duke@1 55 * Kinds of JavaFileObjects.
duke@1 56 */
duke@1 57 enum Kind {
duke@1 58 /**
duke@1 59 * Source files written in the Java programming language. For
duke@1 60 * example, regular files ending with {@code .java}.
duke@1 61 */
duke@1 62 SOURCE(".java"),
duke@1 63
duke@1 64 /**
duke@1 65 * Class files for the Java Virtual Machine. For example,
duke@1 66 * regular files ending with {@code .class}.
duke@1 67 */
duke@1 68 CLASS(".class"),
duke@1 69
duke@1 70 /**
duke@1 71 * HTML files. For example, regular files ending with {@code
duke@1 72 * .html}.
duke@1 73 */
duke@1 74 HTML(".html"),
duke@1 75
duke@1 76 /**
duke@1 77 * Any other kind.
duke@1 78 */
duke@1 79 OTHER("");
duke@1 80 /**
duke@1 81 * The extension which (by convention) is normally used for
duke@1 82 * this kind of file object. If no convention exists, the
duke@1 83 * empty string ({@code ""}) is used.
duke@1 84 */
duke@1 85 public final String extension;
duke@1 86 private Kind(String extension) {
duke@1 87 extension.getClass(); // null check
duke@1 88 this.extension = extension;
duke@1 89 }
duke@1 90 };
duke@1 91
duke@1 92 /**
duke@1 93 * Gets the kind of this file object.
duke@1 94 *
duke@1 95 * @return the kind
duke@1 96 */
duke@1 97 Kind getKind();
duke@1 98
duke@1 99 /**
duke@1 100 * Checks if this file object is compatible with the specified
duke@1 101 * simple name and kind. A simple name is a single identifier
jjh@972 102 * (not qualified) as defined in
jjh@972 103 * <cite>The Java&trade; Language Specification</cite>,
jjh@972 104 * section 6.2 "Names and Identifiers".
duke@1 105 *
duke@1 106 * @param simpleName a simple name of a class
duke@1 107 * @param kind a kind
duke@1 108 * @return {@code true} if this file object is compatible; false
duke@1 109 * otherwise
duke@1 110 */
duke@1 111 boolean isNameCompatible(String simpleName, Kind kind);
duke@1 112
duke@1 113 /**
duke@1 114 * Provides a hint about the nesting level of the class
duke@1 115 * represented by this file object. This method may return
duke@1 116 * {@link NestingKind#MEMBER} to mean
duke@1 117 * {@link NestingKind#LOCAL} or {@link NestingKind#ANONYMOUS}.
duke@1 118 * If the nesting level is not known or this file object does not
duke@1 119 * represent a class file this method returns {@code null}.
duke@1 120 *
duke@1 121 * @return the nesting kind, or {@code null} if the nesting kind
duke@1 122 * is not known
duke@1 123 */
duke@1 124 NestingKind getNestingKind();
duke@1 125
duke@1 126 /**
duke@1 127 * Provides a hint about the access level of the class represented
duke@1 128 * by this file object. If the access level is not known or if
duke@1 129 * this file object does not represent a class file this method
duke@1 130 * returns {@code null}.
duke@1 131 *
duke@1 132 * @return the access level
duke@1 133 */
duke@1 134 Modifier getAccessLevel();
duke@1 135
duke@1 136 }

mercurial