- All Superinterfaces:
AttributedElement,ClassElement,ClassFileElement,CompoundElement<MethodElement>,Iterable<MethodElement>
public sealed interface MethodModel
extends CompoundElement<MethodElement>, AttributedElement, ClassElement
Models a method. A method can be viewed as a composition of
MethodElements, or by random access via accessor
methods if only specific parts of the method is needed.
Methods can be obtained from ClassModel.methods(), or in the
traversal of member elements of a class.
ClassBuilder.withMethod(String, MethodTypeDesc, int, Consumer) is the
main way to construct methods. ClassBuilder.transformMethod(io.smallrye.classfile.MethodModel, io.smallrye.classfile.MethodTransform) allows
creating a new method by selectively processing the original method elements
and directing the results to a method builder.
All method attributes are accessible as member elements.
- Since:
- 24
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptioncode()Returns the body of this method, if there is one.flags()Returns the access flags.Returns the name of this method.Returns the method descriptor string of this method.default MethodTypeDescReturns the method type, as a symbolic descriptor.parent()Returns the class model this method is a member of, if known.Methods inherited from interface io.smallrye.classfile.AttributedElement
attributes, findAttribute, findAttributesMethods inherited from interface io.smallrye.classfile.CompoundElement
elementList, elementStream, forEach, iterator, toDebugStringMethods inherited from interface java.lang.Iterable
spliterator
-
Method Details
-
flags
AccessFlags flags()Returns the access flags.- Returns:
- the access flags
- See Also:
-
parent
Optional<ClassModel> parent()Returns the class model this method is a member of, if known.- Returns:
- the class model this method is a member of, if known
-
methodName
Utf8Entry methodName()Returns the name of this method.- Returns:
- the name of this method
-
methodType
Utf8Entry methodType()Returns the method descriptor string of this method.- Returns:
- the method descriptor string of this method
-
methodTypeSymbol
Returns the method type, as a symbolic descriptor.- Returns:
- the method type, as a symbolic descriptor
-
code
Returns the body of this method, if there is one.- Returns:
- the body of this method, if there is one
-