Interface CompoundElement<E extends ClassFileElement>

Type Parameters:
E - the element type
All Superinterfaces:
ClassFileElement, Iterable<E>
All Known Subinterfaces:
ClassModel, CodeAttribute, CodeModel, FieldModel, MethodModel

public sealed interface CompoundElement<E extends ClassFileElement> extends ClassFileElement, Iterable<E> permits ClassModel, CodeModel, FieldModel, MethodModel (not exhaustive)
A ClassFileElement that has complex structure defined in terms of other classfile elements, such as a method, field, method body, or entire class. When encountering a CompoundElement, clients have the option to treat the element as a single entity (e.g., an entire method) or to traverse the contents of that element with the methods in this class (e.g., forEach(Consumer), etc.)
Sealed Class Hierarchy Graph:
Sealed class hierarchy graph for CompoundElementSealed class hierarchy graph for CompoundElement
Since:
24
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<E>
    Returns an List containing all the elements contained in this compound element.
    default Stream<E>
    Returns a Stream containing all the elements contained in this compound element.
    void
    forEach(Consumer<? super E> consumer)
    Invoke the provided handler with each element contained in this compound element
    default Iterator<E>
    Returns an Iterator describing all the elements contained in this compound element.
    default String
    Returns a text representation of the compound element and its contents for debugging purposes.

    Methods declared in interface java.lang.Iterable

    spliterator
  • Method Details

    • forEach

      void forEach(Consumer<? super E> consumer)
      Invoke the provided handler with each element contained in this compound element
      Specified by:
      forEach in interface Iterable<E extends ClassFileElement>
      Parameters:
      consumer - the handler
    • iterator

      default Iterator<E> iterator()
      Returns an Iterator describing all the elements contained in this compound element.
      Specified by:
      iterator in interface Iterable<E extends ClassFileElement>
      Returns:
      an Iterator describing all the elements contained in this compound element
    • elementStream

      default Stream<E> elementStream()
      Returns a Stream containing all the elements contained in this compound element.
      Returns:
      a Stream containing all the elements contained in this compound element
    • elementList

      default List<E> elementList()
      Returns an List containing all the elements contained in this compound element.
      Returns:
      an List containing all the elements contained in this compound element
    • toDebugString

      default String toDebugString()
      Returns a text representation of the compound element and its contents for debugging purposes. The format, structure and exact contents of the returned string are not specified and may change at any time in the future.
      Returns:
      a text representation of the compound element and its contents for debugging purposes