- All Superinterfaces:
Attribute<EnclosingMethodAttribute>,ClassElement,ClassfileElement,WritableElement<EnclosingMethodAttribute>
- All Known Implementing Classes:
BoundAttribute.BoundEnclosingMethodAttribute,UnboundAttribute.UnboundEnclosingMethodAttribute
public sealed interface EnclosingMethodAttribute
extends Attribute<EnclosingMethodAttribute>, ClassElement
permits BoundAttribute.BoundEnclosingMethodAttribute, UnboundAttribute.UnboundEnclosingMethodAttribute
Models the
EnclosingMethod attribute , which can appear
on classes, and indicates that the class is a local or anonymous class.
Delivered as a ClassElement when traversing the elements of a ClassModel.-
Method Summary
Modifier and TypeMethodDescriptionReturns the innermost class that encloses the declaration of the current class.Returns the name and type of the enclosing method, if the class is immediately enclosed by a method or constructor.Returns the name of the enclosing method, if the class is immediately enclosed by a method or constructor.Returns the type of the enclosing method, if the class is immediately enclosed by a method or constructor.default Optional<MethodTypeDesc>Returns the type of the enclosing method, if the class is immediately enclosed by a method or constructor.static EnclosingMethodAttributeReturns anEnclosingMethodattribute.static EnclosingMethodAttributeof(ClassEntry className, Optional<NameAndTypeEntry> method) Returns anEnclosingMethodattribute.Methods inherited from interface org.glavo.classfile.Attribute
attributeMapper, attributeNameMethods inherited from interface org.glavo.classfile.WritableElement
writeTo
-
Method Details
-
enclosingClass
ClassEntry enclosingClass()Returns the innermost class that encloses the declaration of the current class.- Returns:
- the innermost class that encloses the declaration of the current class
-
enclosingMethod
Optional<NameAndTypeEntry> enclosingMethod()Returns the name and type of the enclosing method, if the class is immediately enclosed by a method or constructor.- Returns:
- the name and type of the enclosing method, if the class is immediately enclosed by a method or constructor
-
enclosingMethodName
Returns the name of the enclosing method, if the class is immediately enclosed by a method or constructor.- Returns:
- the name of the enclosing method, if the class is immediately enclosed by a method or constructor
-
enclosingMethodType
Returns the type of the enclosing method, if the class is immediately enclosed by a method or constructor.- Returns:
- the type of the enclosing method, if the class is immediately enclosed by a method or constructor
-
enclosingMethodTypeSymbol
Returns the type of the enclosing method, if the class is immediately enclosed by a method or constructor.- Returns:
- the type of the enclosing method, if the class is immediately enclosed by a method or constructor
-
of
Returns anEnclosingMethodattribute.- Parameters:
className- the class namemethod- the name and type of the enclosing method- Returns:
- an
EnclosingMethodattribute
-
of
static EnclosingMethodAttribute of(ClassDesc className, Optional<String> methodName, Optional<MethodTypeDesc> methodType) Returns anEnclosingMethodattribute.- Parameters:
className- the class namemethodName- the name of the enclosing methodmethodType- the type of the enclosing method- Returns:
- an
EnclosingMethodattribute
-