Interface CodeModel
- All Superinterfaces:
AttributedElementPREVIEW
,ClassFileElementPREVIEW
,CompoundElementPREVIEW<CodeElementPREVIEW>
,Iterable<CodeElementPREVIEW>
,MethodElementPREVIEW
- All Known Subinterfaces:
CodeAttributePREVIEW
public sealed interface CodeModel
extends CompoundElementPREVIEW<CodeElementPREVIEW>, AttributedElementPREVIEW, MethodElementPREVIEW
permits CodeAttributePREVIEW (not exhaustive)
CodeModel
is a preview API of the Java platform.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the body of a method (the
Code
attribute). The instructions
of the method body are accessed via a streaming view.- Since:
- 22
-
Method Summary
Modifier and TypeMethodDescriptionReturns the exception table of the method.parent()
Returns the enclosing method, if known.Methods declared in interface java.lang.classfile.AttributedElementPREVIEW
attributes, findAttribute, findAttributes
Methods declared in interface java.lang.classfile.CompoundElementPREVIEW
elementList, elementStream, forEach, iterator
Methods declared in interface java.lang.Iterable
spliterator
-
Method Details
-
parent
Optional<MethodModelPREVIEW> parent()Returns the enclosing method, if known.- Returns:
- the enclosing method, if known
-
exceptionHandlers
List<ExceptionCatchPREVIEW> exceptionHandlers()Returns the exception table of the method. The exception table is also modeled byExceptionCatch
PREVIEW elements in the streaming view.- Returns:
- the exception table of the method
-
CodeModel
when preview features are enabled.