Module org.glavo.classfile
Package org.glavo.classfile
Interface ClassfileBuilder<E extends ClassfileElement,B extends ClassfileBuilder<E,B>>
- All Superinterfaces:
Consumer<E>
- All Known Subinterfaces:
ClassBuilder,CodeBuilder,CodeBuilder.BlockCodeBuilder,FieldBuilder,MethodBuilder,TerminalCodeBuilder,TerminalFieldBuilder,TerminalMethodBuilder
- All Known Implementing Classes:
BlockCodeBuilderImpl,BufferedCodeBuilder,BufferedFieldBuilder,BufferedMethodBuilder,ChainedClassBuilder,ChainedCodeBuilder,ChainedFieldBuilder,ChainedMethodBuilder,DirectClassBuilder,DirectCodeBuilder,DirectFieldBuilder,DirectMethodBuilder,NonterminalCodeBuilder,TransformingCodeBuilder
public interface ClassfileBuilder<E extends ClassfileElement,B extends ClassfileBuilder<E,B>>
extends Consumer<E>
A builder for a classfile or portion of a classfile. Builders are rarely
created directly; they are passed to handlers by methods such as
Classfile.build(ClassDesc, Consumer) or to transforms.
Elements of the newly built entity can be specified
abstractly (by passing a ClassfileElement to with(ClassfileElement)
or concretely by calling the various withXxx methods.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidIntegrate theClassfileElementinto the entity being built.default booleancanWriteDirect(ConstantPool source) Returns whether the provided constant pool is compatible with this builder.Returns the constant pool builder associated with this builder.default voidtransform(CompoundElement<E> model, ClassfileTransform<?, E, B> transform) Apply a transform to a model, directing results to this builder.Integrate theClassfileElementinto the entity being built.
-
Method Details
-
accept
Integrate theClassfileElementinto the entity being built.- Specified by:
acceptin interfaceConsumer<E extends ClassfileElement>- Parameters:
e- the element
-
with
Integrate theClassfileElementinto the entity being built.- Parameters:
e- the element- Returns:
- this builder
-
constantPool
ConstantPoolBuilder constantPool()Returns the constant pool builder associated with this builder.- Returns:
- the constant pool builder associated with this builder
-
canWriteDirect
Returns whether the provided constant pool is compatible with this builder.- Parameters:
source- the constant pool to test compatibility with- Returns:
- whether the provided constant pool is compatible with this builder
-
transform
Apply a transform to a model, directing results to this builder.- Parameters:
model- the model to transformtransform- the transform to apply
-