Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/src/share/classes/javax/lang/model/element/ExecutableElement.java
38899 views
/*1* Copyright (c) 2005, 2013, 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* Returns the formal type parameters of this executable44* in declaration order.45*46* @return the formal type parameters, or an empty list47* if there are none48*/49List<? extends TypeParameterElement> getTypeParameters();5051/**52* Returns the return type of this executable.53* Returns a {@link NoType} with kind {@link TypeKind#VOID VOID}54* if this executable is not a method, or is a method that does not55* return a value.56*57* @return the return type of this executable58*/59TypeMirror getReturnType();6061/**62* Returns the formal parameters of this executable.63* They are returned in declaration order.64*65* @return the formal parameters,66* or an empty list if there are none67*/68List<? extends VariableElement> getParameters();6970/**71* Returns the receiver type of this executable,72* or {@link javax.lang.model.type.NoType NoType} with73* kind {@link javax.lang.model.type.TypeKind#NONE NONE}74* if the executable has no receiver type.75*76* An executable which is an instance method, or a constructor of an77* inner class, has a receiver type derived from the {@linkplain78* #getEnclosingElement declaring type}.79*80* An executable which is a static method, or a constructor of a81* non-inner class, or an initializer (static or instance), has no82* receiver type.83*84* @return the receiver type of this executable85* @since 1.886*/87TypeMirror getReceiverType();8889/**90* Returns {@code true} if this method or constructor accepts a variable91* number of arguments and returns {@code false} otherwise.92*93* @return {@code true} if this method or constructor accepts a variable94* number of arguments and {@code false} otherwise95*/96boolean isVarArgs();9798/**99* Returns {@code true} if this method is a default method and100* returns {@code false} otherwise.101*102* @return {@code true} if this method is a default method and103* {@code false} otherwise104* @since 1.8105*/106boolean isDefault();107108/**109* Returns the exceptions and other throwables listed in this110* method or constructor's {@code throws} clause in declaration111* order.112*113* @return the exceptions and other throwables listed in the114* {@code throws} clause, or an empty list if there are none115*/116List<? extends TypeMirror> getThrownTypes();117118/**119* Returns the default value if this executable is an annotation120* type element. Returns {@code null} if this method is not an121* annotation type element, or if it is an annotation type element122* with no default value.123*124* @return the default value, or {@code null} if none125*/126AnnotationValue getDefaultValue();127128/**129* Returns the simple name of a constructor, method, or130* initializer. For a constructor, the name {@code "<init>"} is131* returned, for a static initializer, the name {@code "<clinit>"}132* is returned, and for an anonymous class or instance133* initializer, an empty name is returned.134*135* @return the simple name of a constructor, method, or136* initializer137*/138@Override139Name getSimpleName();140}141142143