java.lang.Object
org.glavo.classfile.impl.AbstractDirectBuilder<ClassModel>
org.glavo.classfile.impl.DirectClassBuilder
- All Implemented Interfaces:
Consumer<ClassElement>,ClassBuilder,ClassFileBuilder<ClassElement,ClassBuilder>
public final class DirectClassBuilder
extends AbstractDirectBuilder<ClassModel>
implements ClassBuilder
-
Field Summary
Fields inherited from class org.glavo.classfile.impl.AbstractDirectBuilder
attributes, constantPool, context, original -
Constructor Summary
ConstructorsConstructorDescriptionDirectClassBuilder(SplitConstantPool constantPool, ClassFileImpl context, ClassEntry thisClass) -
Method Summary
Modifier and TypeMethodDescriptionbyte[]build()voidsetSizeHint(int sizeHint) transformField(FieldModel field, FieldTransform transform) Adds a field by transforming a field from another class.transformMethod(MethodModel method, MethodTransform transform) Adds a method by transforming a method from another class.with(ClassElement element) Integrate theClassFileElementinto the entity being built.withField(Utf8Entry name, Utf8Entry descriptor, Consumer<? super FieldBuilder> handler) Adds a field.withField(WritableElement<FieldModel> field) withMethod(Utf8Entry name, Utf8Entry descriptor, int flags, Consumer<? super MethodBuilder> handler) Adds a method.withMethod(WritableElement<MethodModel> method) Methods inherited from class org.glavo.classfile.impl.AbstractDirectBuilder
constantPool, original, setOriginal, writeAttributeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.glavo.classfile.ClassBuilder
original, withField, withField, withField, withFlags, withFlags, withInterfaces, withInterfaces, withInterfaceSymbols, withInterfaceSymbols, withMethod, withMethodBody, withMethodBody, withSuperclass, withSuperclass, withVersionMethods inherited from interface org.glavo.classfile.ClassFileBuilder
accept, canWriteDirect, constantPool, transform
-
Constructor Details
-
DirectClassBuilder
public DirectClassBuilder(SplitConstantPool constantPool, ClassFileImpl context, ClassEntry thisClass)
-
-
Method Details
-
with
Description copied from interface:ClassFileBuilderIntegrate theClassFileElementinto the entity being built.- Specified by:
within interfaceClassFileBuilder<ClassElement,ClassBuilder> - Parameters:
element- the element- Returns:
- this builder
-
withField
public ClassBuilder withField(Utf8Entry name, Utf8Entry descriptor, Consumer<? super FieldBuilder> handler) Description copied from interface:ClassBuilderAdds a field.- Specified by:
withFieldin interfaceClassBuilder- Parameters:
name- the name of the fielddescriptor- the field descriptorhandler- handler which receives aFieldBuilderwhich can further define the contents of the field- Returns:
- this builder
-
transformField
Description copied from interface:ClassBuilderAdds a field by transforming a field from another class.- Specified by:
transformFieldin interfaceClassBuilder- Parameters:
field- the field to be transformedtransform- the transform to apply to the field- Returns:
- this builder
-
withMethod
public ClassBuilder withMethod(Utf8Entry name, Utf8Entry descriptor, int flags, Consumer<? super MethodBuilder> handler) Description copied from interface:ClassBuilderAdds a method.- Specified by:
withMethodin interfaceClassBuilder- Parameters:
name- the name of the methoddescriptor- the method descriptorflags- the access flagshandler- handler which receives aMethodBuilderwhich can further define the contents of the method- Returns:
- this builder
-
transformMethod
Description copied from interface:ClassBuilderAdds a method by transforming a method from another class.- Specified by:
transformMethodin interfaceClassBuilder- Parameters:
method- the method to be transformedtransform- the transform to apply to the method- Returns:
- this builder
-
withField
-
withMethod
-
setSizeHint
public void setSizeHint(int sizeHint) -
build
public byte[] build()
-