Tree
public interface MethodTree extends Tree
modifiers typeParameters type name ( parameters ) body modifiers type name () default defaultValue
Modifier and Type | Method | Description |
---|---|---|
BlockTree |
getBody() |
Returns the method body, or null if this is an abstract or native method. |
Tree |
getDefaultValue() |
Returns the default value, if this is an element within an annotation type declaration. |
ModifiersTree |
getModifiers() |
Returns the modifiers, including any annotations for the method being declared. |
Name |
getName() |
Returns the name of the method being declared. |
List |
getParameters() |
Returns the parameters of the method being declared. |
VariableTree |
getReceiverParameter() |
Return an explicit receiver parameter ("this" parameter), or null if none. |
Tree |
getReturnType() |
Returns the return type of the method being declared. |
List |
getThrows() |
Returns the exceptions listed as being thrown by this method. |
List |
getTypeParameters() |
Returns the type parameters of the method being declared. |
ModifiersTree getModifiers()
Name getName()
Tree getReturnType()
null
for a constructor.List<? extends TypeParameterTree> getTypeParameters()
List<? extends VariableTree> getParameters()
VariableTree getReceiverParameter()
null
if none.List<? extends ExpressionTree> getThrows()
BlockTree getBody()
null
if this is an abstract or native method.Tree getDefaultValue()
null
otherwise.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.compiler/com/sun/source/tree/MethodTree.html