duke@1: /* jjg@1357: * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package javax.lang.model.element; duke@1: duke@1: import java.util.List; duke@1: import javax.lang.model.type.*; duke@1: duke@1: /** duke@1: * Represents a method, constructor, or initializer (static or duke@1: * instance) of a class or interface, including annotation type duke@1: * elements. duke@1: * duke@1: * @author Joseph D. Darcy duke@1: * @author Scott Seligman duke@1: * @author Peter von der Ahé duke@1: * @see ExecutableType duke@1: * @since 1.6 duke@1: */ darcy@224: public interface ExecutableElement extends Element, Parameterizable { duke@1: /** duke@1: * Returns the formal type parameters of this executable duke@1: * in declaration order. duke@1: * duke@1: * @return the formal type parameters, or an empty list duke@1: * if there are none duke@1: */ duke@1: List getTypeParameters(); duke@1: duke@1: /** duke@1: * Returns the return type of this executable. duke@1: * Returns a {@link NoType} with kind {@link TypeKind#VOID VOID} duke@1: * if this executable is not a method, or is a method that does not duke@1: * return a value. duke@1: * duke@1: * @return the return type of this executable duke@1: */ duke@1: TypeMirror getReturnType(); duke@1: duke@1: /** duke@1: * Returns the formal parameters of this executable. duke@1: * They are returned in declaration order. duke@1: * duke@1: * @return the formal parameters, duke@1: * or an empty list if there are none duke@1: */ duke@1: List getParameters(); duke@1: duke@1: /** duke@1: * Returns {@code true} if this method or constructor accepts a variable duke@1: * number of arguments and returns {@code false} otherwise. duke@1: * duke@1: * @return {@code true} if this method or constructor accepts a variable duke@1: * number of arguments and {@code false} otherwise duke@1: */ duke@1: boolean isVarArgs(); duke@1: duke@1: /** duke@1: * Returns the exceptions and other throwables listed in this duke@1: * method or constructor's {@code throws} clause in declaration duke@1: * order. duke@1: * duke@1: * @return the exceptions and other throwables listed in the duke@1: * {@code throws} clause, or an empty list if there are none duke@1: */ duke@1: List getThrownTypes(); duke@1: duke@1: /** duke@1: * Returns the default value if this executable is an annotation duke@1: * type element. Returns {@code null} if this method is not an duke@1: * annotation type element, or if it is an annotation type element duke@1: * with no default value. duke@1: * duke@1: * @return the default value, or {@code null} if none duke@1: */ duke@1: AnnotationValue getDefaultValue(); darcy@849: darcy@849: /** darcy@849: * Returns the simple name of a constructor, method, or darcy@849: * initializer. For a constructor, the name {@code ""} is darcy@849: * returned, for a static initializer, the name {@code ""} darcy@849: * is returned, and for an anonymous class or instance darcy@849: * initializer, an empty name is returned. darcy@849: * darcy@849: * @return the simple name of a constructor, method, or darcy@849: * initializer darcy@849: */ darcy@849: @Override darcy@849: Name getSimpleName(); duke@1: }