Interface MethodInfo
- All Superinterfaces:
AnnotationTarget
,DeclarationInfo
A method or a constructor, declared in some class.
- Since:
- 4.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.enterprise.lang.model.declarations.DeclarationInfo
DeclarationInfo.Kind
-
Method Summary
Modifier and TypeMethodDescriptiondefault MethodInfo
asMethod()
Returns this declaration as a method.Returns the class that declares this method.boolean
Returns whether this method is abstract.boolean
Returns whether this method is, in fact, a constructor.boolean
isFinal()
Returns whether this method isfinal
.boolean
isStatic()
Returns whether this method isstatic
.default DeclarationInfo.Kind
kind()
Returns the kind of this declaration.int
Returns the modifiers of this method as anint
.name()
Returns the name of this method.Returns a list of parameters declared or implicitly declared on this method.Returns the type of the receiver parameter declared by this method.Returns the return type of this method.Returns a list of exception types that are declared to be thrown by this method.Returns a list of type parameters declared on this method.Methods inherited from interface jakarta.enterprise.lang.model.AnnotationTarget
annotation, annotations, annotations, hasAnnotation, hasAnnotation, repeatableAnnotation
Methods inherited from interface jakarta.enterprise.lang.model.declarations.DeclarationInfo
asClass, asDeclaration, asField, asPackage, asParameter, asRecordComponent, asType, isClass, isDeclaration, isField, isMethod, isPackage, isParameter, isRecordComponent, isType
-
Method Details
-
name
String name()Returns the name of this method. In case of constructors, returns the binary name of the declaring class.- Returns:
- the name of this method, never
null
-
parameters
List<ParameterInfo> parameters()Returns a list of parameters declared or implicitly declared on this method.- Returns:
- immutable list of parameters, never
null
-
returnType
Type returnType()Returns the return type of this method. In case of constructors, returns the type of the declaring class.- Returns:
- the return type of this method, never
null
-
receiverType
Type receiverType()Returns the type of the receiver parameter declared by this method. Returnsnull
if this method cannot declare a receiver parameter; that is, if this method isstatic
or is a constructor of a top-level class or astatic
nested class. If this method may declare a receiver parameter but does not, returns aType
with no annotations.- 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
-
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:
- immutable list of exception types, never
null
-
typeParameters
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:
- immutable list of type parameters, never
null
-
isConstructor
boolean isConstructor()Returns whether this method is, in fact, a constructor.- Returns:
- whether this method is, in fact, a constructor
-
isStatic
boolean isStatic()Returns whether this method isstatic
.- Returns:
- whether this method is
static
.
-
isAbstract
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 declaredabstract
. An instance method declared on an interface is abstract unless declareddefault
. An instance method declared on an annotation type is always abstract. An instance method declared on a record type is never abstract.- Returns:
- whether this method is
abstract
.
-
isFinal
boolean isFinal()Returns whether this method isfinal
.- Returns:
- whether this method is
final
.
-
modifiers
int modifiers()Returns the modifiers of this method as anint
. UseModifier
to inspect the value.- Returns:
- the modifiers of this method
-
declaringClass
ClassInfo declaringClass()Returns the class that declares this method.- Returns:
- the class that declares this method, never
null
-
kind
Description copied from interface:DeclarationInfo
Returns the kind of this declaration.- Specified by:
kind
in interfaceDeclarationInfo
- Returns:
- the kind of this declaration
-
asMethod
Description copied from interface:DeclarationInfo
Returns this declaration as a method.- Specified by:
asMethod
in interfaceDeclarationInfo
- Returns:
- this method, never
null
-