Interface CompoundElement<E extends ClassFileElement>
- Type Parameters:
E
- the member 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
class
file structure that can be viewed as a composition of its
member structures. CompoundElement
allows users to traverse these
member elements with forEach(Consumer)
or elementStream()
,
or buffer the elements obtained from the traversal through iterator()
or elementList()
.
Unless otherwise specified, all member elements of compatible type will be presented during the traversal if they exist in this element. Some member elements specify that they may appear at most once in this element; if such elements are presented multiple times, the latest occurrence is authentic and all previous occurrences should be ignored.
CompoundElement
s can be constructed by ClassFileBuilder
s.
ClassFileBuilder.transform(CompoundElement, ClassFileTransform)
provides an easy way to create a new structure by selectively processing
the original member structures and directing the results to the builder.
-
Method Summary
Modifier and TypeMethodDescriptionReturns aList
containing all member elements in this compound element.Returns aStream
containing all member elements in this compound element.void
Invokes the provided handler with each member element in this compound element.iterator()
Returns anIterator
describing all member elements 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
-
iterator
-
elementStream
-
elementList
-
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
-