< prev index next >

src/java.compiler/share/classes/javax/lang/model/util/Elements.java

Print this page

 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 
 26 package javax.lang.model.util;
 27 
 28 import java.util.Collections;
 29 import java.util.List;
 30 import java.util.Map;

 31 import java.util.Set;
 32 import java.util.LinkedHashSet;
 33 import java.util.Objects;
 34 
 35 import javax.lang.model.AnnotatedConstruct;
 36 import javax.lang.model.element.*;
 37 
 38 
 39 /**
 40  * Utility methods for operating on program elements.
 41  *
 42  * <p><b>Compatibility Note:</b> Methods may be added to this interface
 43  * in future releases of the platform.
 44  *
 45  * @see javax.annotation.processing.ProcessingEnvironment#getElementUtils
 46  * @since 1.6
 47  */
 48 public interface Elements {
 49 
 50     /**

951      * <p>For other lexically enclosed elements, such as {@linkplain
952      * VariableElement#getEnclosingElement() variables}, {@linkplain
953      * ExecutableElement#getEnclosingElement() methods, and
954      * constructors}, if they have a file object, the file object will
955      * be the object associated with the {@linkplain
956      * Element#getEnclosingElement() enclosing element} of the
957      * lexically enclosed element.
958      *
959      * @implSpec The default implementation unconditionally throws
960      * {@link UnsupportedOperationException}.
961      *
962      * @throws UnsupportedOperationException if this functionality is
963      * not supported
964      *
965      * @param e the element to find a file object for
966      * @since 18
967      */
968     default javax.tools.JavaFileObject getFileObjectOf(Element e) {
969         throw new UnsupportedOperationException();
970     }
















971 }

 11  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  * version 2 for more details (a copy is included in the LICENSE file that
 15  * accompanied this code).
 16  *
 17  * You should have received a copy of the GNU General Public License version
 18  * 2 along with this work; if not, write to the Free Software Foundation,
 19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  *
 21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 22  * or visit www.oracle.com if you need additional information or have any
 23  * questions.
 24  */
 25 
 26 package javax.lang.model.util;
 27 
 28 import java.util.Collections;
 29 import java.util.List;
 30 import java.util.Map;
 31 import java.util.Optional;
 32 import java.util.Set;
 33 import java.util.LinkedHashSet;
 34 import java.util.Objects;
 35 
 36 import javax.lang.model.AnnotatedConstruct;
 37 import javax.lang.model.element.*;
 38 
 39 
 40 /**
 41  * Utility methods for operating on program elements.
 42  *
 43  * <p><b>Compatibility Note:</b> Methods may be added to this interface
 44  * in future releases of the platform.
 45  *
 46  * @see javax.annotation.processing.ProcessingEnvironment#getElementUtils
 47  * @since 1.6
 48  */
 49 public interface Elements {
 50 
 51     /**

952      * <p>For other lexically enclosed elements, such as {@linkplain
953      * VariableElement#getEnclosingElement() variables}, {@linkplain
954      * ExecutableElement#getEnclosingElement() methods, and
955      * constructors}, if they have a file object, the file object will
956      * be the object associated with the {@linkplain
957      * Element#getEnclosingElement() enclosing element} of the
958      * lexically enclosed element.
959      *
960      * @implSpec The default implementation unconditionally throws
961      * {@link UnsupportedOperationException}.
962      *
963      * @throws UnsupportedOperationException if this functionality is
964      * not supported
965      *
966      * @param e the element to find a file object for
967      * @since 18
968      */
969     default javax.tools.JavaFileObject getFileObjectOf(Element e) {
970         throw new UnsupportedOperationException();
971     }
972 
973     /**
974      * Returns the code model of provided executable element (if any).
975      * <p>
976      * If the executable element has a code model then it will be an instance of
977      * {@code java.lang.reflect.code.op.CoreOps.FuncOp}.
978      * Note: due to circular dependencies we cannot refer to the type explicitly.
979      *
980      * @implSpec The default implementation unconditionally returns an empty optional.
981      * @param e the executable element.
982      * @return the code model of the provided executable element (if any).
983      * @since 99
984      */
985     default Optional<Object> getBody(ExecutableElement e) {
986         return Optional.empty();
987     }
988 }
< prev index next >