Path: blob/master/src/java.compiler/share/classes/javax/lang/model/element/ExecutableElement.java
41161 views
/*1* Copyright (c) 2005, 2020, 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.lang.model.element;2627import java.util.List;28import javax.lang.model.type.*;2930/**31* Represents a method, constructor, or initializer (static or32* instance) of a class or interface, including annotation type33* elements.34*35* @author Joseph D. Darcy36* @author Scott Seligman37* @author Peter von der Ahé38* @see ExecutableType39* @since 1.640*/41public interface ExecutableElement extends Element, Parameterizable {42/**43* {@return the {@linkplain ExecutableType executable type} defined44* by this executable element}45*46* @see ExecutableType47*/48@Override49TypeMirror asType();5051/**52* Returns the formal type parameters of this executable53* in declaration order.54*55* @return the formal type parameters, or an empty list56* if there are none57*/58List<? extends TypeParameterElement> getTypeParameters();5960/**61* {@return the return type of this executable}62* Returns a {@link NoType} with kind {@link TypeKind#VOID VOID}63* if this executable is not a method, or is a method that does not64* return a value.65*/66TypeMirror getReturnType();6768/**69* Returns the formal parameters of this executable.70* They are returned in declaration order.71*72* @return the formal parameters,73* or an empty list if there are none74*/75List<? extends VariableElement> getParameters();7677/**78* Returns the receiver type of this executable,79* or {@link javax.lang.model.type.NoType NoType} with80* kind {@link javax.lang.model.type.TypeKind#NONE NONE}81* if the executable has no receiver type.82*83* An executable which is an instance method, or a constructor of an84* inner class, has a receiver type derived from the {@linkplain85* #getEnclosingElement declaring type}.86*87* An executable which is a static method, or a constructor of a88* non-inner class, or an initializer (static or instance), has no89* receiver type.90*91* @return the receiver type of this executable92* @since 1.893*94* @jls 8.4 Method Declarations95* @jls 8.4.1 Formal Parameters96* @jls 8.8 Constructor Declarations97*/98TypeMirror getReceiverType();99100/**101* {@return {@code true} if this method or constructor accepts a variable102* number of arguments and returns {@code false} otherwise}103*/104boolean isVarArgs();105106/**107* {@return {@code true} if this method is a default method and108* returns {@code false} otherwise}109* @since 1.8110*/111boolean isDefault();112113/**114* Returns the exceptions and other throwables listed in this115* method or constructor's {@code throws} clause in declaration116* order.117*118* @return the exceptions and other throwables listed in the119* {@code throws} clause, or an empty list if there are none120*/121List<? extends TypeMirror> getThrownTypes();122123/**124* Returns the default value if this executable is an annotation125* interface element. Returns {@code null} if this method is not126* an annotation interface element, or if it is an annotation127* interface element with no default value.128*129* @return the default value, or {@code null} if none130*/131AnnotationValue getDefaultValue();132133/**134* {@return the simple name of a constructor, method, or135* initializer} For a constructor, the name {@code "<init>"} is136* returned, for a static initializer, the name {@code "<clinit>"}137* is returned, and for an anonymous class or instance138* initializer, an <a href=Name.html#empty_name>empty name</a> is139* returned.140*/141@Override142Name getSimpleName();143}144145146