Top Description Methods
jakarta.enterprise.lang.model.declarations

public Interface MethodInfo

extends DeclarationInfo
Imports
jakarta.enterprise.lang.model.types.Type, .TypeVariable, java.util.List

A method or a constructor, declared in some class.
Since
4.0

Method Summary

Modifier and TypeMethod and Description
public default MethodInfo
asMethod()

Overrides default jakarta.enterprise.lang.model.declarations.DeclarationInfo.asMethod.

Returns this declaration as a method.
public ClassInfo

Returns:

the class that declares this method, never null
declaringClass
()

Returns the class that declares this method.

public boolean

Returns:

whether this method is abstract.
isAbstract
()

Returns whether this method is abstract.

public boolean

Returns:

whether this method is, in fact, a constructor
isConstructor
()

Returns whether this method is, in fact, a constructor.

public boolean

Returns:

whether this method is final.
isFinal
()

Returns whether this method is final.

public boolean

Returns:

whether this method is static.
isStatic
()

Returns whether this method is static.

public default DeclarationInfo.Kind
kind()

Implements jakarta.enterprise.lang.model.declarations.DeclarationInfo.kind.

Returns the kind of this declaration.
public int

Returns:

the modifiers of this method
modifiers
()

Returns the modifiers of this method as an int.

public String

Returns:

the name of this method, never null
name
()

Returns the name of this method.

public List<ParameterInfo>

Returns:

immutable list of parameterts, never null
parameters
()

Returns a list of parameters declared or implicitly declared on this method.

public Type

Returns:

the type of the receiver parameter declared by this method, with or without annotations, or null if this method cannot declare a receiver parameter
receiverType
()

Returns the type of the receiver parameter declared by this method.

public Type

Returns:

the return type of this method, never null
returnType
()

Returns the return type of this method.

public List<Type>

Returns:

immutable list of exception types, never null
throwsTypes
()

Returns a list of exception types that are declared to be thrown by this method.

public List<TypeVariable>

Returns:

immutable list of type parameters, never null
typeParameters
()

Returns a list of type parameters declared on this method.

Inherited from jakarta.enterprise.lang.model.declarations.DeclarationInfo:
asClassasDeclarationasFieldasPackageasParameterasRecordComponentasTypeisClassisDeclarationisFieldisMethodisPackageisParameterisRecordComponentisType

Method Detail

asMethodback to summary
public default MethodInfo asMethod()

Overrides default jakarta.enterprise.lang.model.declarations.DeclarationInfo.asMethod.

Doc from jakarta.enterprise.lang.model.declarations.DeclarationInfo.asMethod.

Returns this declaration as a method.

Returns:MethodInfo

this method, never null

Annotations
@Override
declaringClassback to summary
public ClassInfo declaringClass()

Returns the class that declares this method.

Returns:ClassInfo

the class that declares this method, never null

isAbstractback to summary
public boolean isAbstract()

Returns whether this method is abstract.

A static method is never abstract. An instance method declared on a plain class or an enum is abstract if declared abstract. An instance method declared on an interface is abstract unless declared default. An instance method declared on an annotation type is always abstract. An instance method declared on a record type is never abstract.

Returns:boolean

whether this method is abstract.

isConstructorback to summary
public boolean isConstructor()

Returns whether this method is, in fact, a constructor.

Returns:boolean

whether this method is, in fact, a constructor

isFinalback to summary
public boolean isFinal()

Returns whether this method is final.

Returns:boolean

whether this method is final.

isStaticback to summary
public boolean isStatic()

Returns whether this method is static.

Returns:boolean

whether this method is static.

kindback to summary
public default DeclarationInfo.Kind kind()

Implements jakarta.enterprise.lang.model.declarations.DeclarationInfo.kind.

Doc from jakarta.enterprise.lang.model.declarations.DeclarationInfo.kind.

Returns the kind of this declaration.

Returns:DeclarationInfo.Kind

the kind of this declaration

Annotations
@Override
modifiersback to summary
public int modifiers()

Returns the modifiers of this method as an int. Use Modifier to inspect the value.

Returns:int

the modifiers of this method

nameback to summary
public String name()

Returns the name of this method. In case of constructors, returns the binary name of the declaring class.

Returns:String

the name of this method, never null

parametersback to summary
public List<ParameterInfo> parameters()

Returns a list of parameters declared or implicitly declared on this method.

Returns:List<ParameterInfo>

immutable list of parameterts, never null

receiverTypeback to summary
public Type receiverType()

Returns the type of the receiver parameter declared by this method. Returns null if this method cannot declare a receiver parameter; that is, if this method is static or is a constructor of a top-level class or a static nested class. If this method may declare a receiver parameter but does not, returns a Type with no annotations.

Returns:Type

the type of the receiver parameter declared by this method, with or without annotations, or null if this method cannot declare a receiver parameter

returnTypeback to summary
public Type returnType()

Returns the return type of this method. In case of constructors, returns the type of the declaring class.

Returns:Type

the return type of this method, never null

throwsTypesback to summary
public List<Type> throwsTypes()

Returns a list of exception types that are declared to be thrown by this method. Returns an empty list if this method does not declare any exception.

Returns:List<Type>

immutable list of exception types, never null

typeParametersback to summary
public List<TypeVariable> typeParameters()

Returns a list of type parameters declared on this method. Returns an empty list if this method is not generic and so does not declare type parameters.

Returns:List<TypeVariable>

immutable list of type parameters, never null