Interface EnclosingMethodAttribute

All Superinterfaces:
Attribute<EnclosingMethodAttribute>, ClassElement, ClassfileElement, WritableElement<EnclosingMethodAttribute>
All Known Implementing Classes:
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 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

      default Optional<Utf8Entry> 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

      default Optional<Utf8Entry> 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

      default Optional<MethodTypeDesc> 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 an EnclosingMethod attribute.
      Parameters:
      className - the class name
      method - the name and type of the enclosing method
      Returns:
      an EnclosingMethod attribute
    • of

      static EnclosingMethodAttribute of(ClassDesc className, Optional<String> methodName, Optional<MethodTypeDesc> methodType)
      Returns an EnclosingMethod attribute.
      Parameters:
      className - the class name
      methodName - the name of the enclosing method
      methodType - the type of the enclosing method
      Returns:
      an EnclosingMethod attribute