# Uses of Interface
java.lang.classfile.ClassBuilder

Packages that use ClassBuilder
Package
Description
java.lang.classfile
Provides classfile parsing, generation, and transformation library.

## Uses of ClassBuilder in java.lang.classfile

Subinterfaces with type arguments of type ClassBuilder in java.lang.classfile
Modifier and Type
Interface
Description
`interface`
`ClassBuilder`
A builder for a `class` file.
`interface`
`ClassTransform`
A transformation on streams of `ClassElement`.
Methods in java.lang.classfile that return ClassBuilder
Modifier and Type
Method
Description
`ClassBuilder`
ClassBuilder.`transformField(FieldModel field, FieldTransform transform)`
Adds a field by transforming a field from another class.
`ClassBuilder`
ClassBuilder.`transformMethod(MethodModel method, MethodTransform transform)`
Adds a method by transforming a method from another class.
`default ClassBuilder`
ClassBuilder.`withField(Utf8Entry name, Utf8Entry descriptor, int flags)`
Adds a field, with only access flags.
`ClassBuilder`
ClassBuilder.`withField(Utf8Entry name, Utf8Entry descriptor, Consumer<? super FieldBuilder> handler)`
Adds a field.
`default ClassBuilder`
ClassBuilder.`withField(String name, ClassDesc descriptor, int flags)`
Adds a field, with only access flags.
`default ClassBuilder`
ClassBuilder.`withField(String name, ClassDesc descriptor, Consumer<? super FieldBuilder> handler)`
Adds a field.
`default ClassBuilder`
ClassBuilder.`withFlags(int flags)`
Sets the access flags of this class.
`default ClassBuilder`
ClassBuilder.`withFlags(AccessFlag... flags)`
Sets the access flags of this class.
`default ClassBuilder`
ClassBuilder.`withInterfaces(ClassEntry... interfaces)`
Sets the interfaces of this class.
`default ClassBuilder`
ClassBuilder.`withInterfaces(List<ClassEntry> interfaces)`
Sets the interfaces of this class.
`default ClassBuilder`
ClassBuilder.`withInterfaceSymbols(ClassDesc... interfaces)`
Sets the interfaces of this class.
`default ClassBuilder`
ClassBuilder.`withInterfaceSymbols(List<ClassDesc> interfaces)`
Sets the interfaces of this class.
`ClassBuilder`
ClassBuilder.`withMethod(Utf8Entry name, Utf8Entry descriptor, int methodFlags, Consumer<? super MethodBuilder> handler)`
Adds a method.
`default ClassBuilder`
ClassBuilder.`withMethod(String name, MethodTypeDesc descriptor, int methodFlags, Consumer<? super MethodBuilder> handler)`
Adds a method.
`default ClassBuilder`
ClassBuilder.`withMethodBody(Utf8Entry name, Utf8Entry descriptor, int methodFlags, Consumer<? super CodeBuilder> handler)`
Adds a method, with only access flags and a `CodeModel`.
`default ClassBuilder`
ClassBuilder.`withMethodBody(String name, MethodTypeDesc descriptor, int methodFlags, Consumer<? super CodeBuilder> handler)`
Adds a method, with only access flags and a `CodeModel`.
`default ClassBuilder`
ClassBuilder.`withSuperclass(ClassEntry superclassEntry)`
Sets the superclass of this class.
`default ClassBuilder`
ClassBuilder.`withSuperclass(ClassDesc desc)`
Sets the superclass of this class.
`default ClassBuilder`
ClassBuilder.`withVersion(int major, int minor)`
Sets the version of this class.
Method parameters in java.lang.classfile with type arguments of type ClassBuilder
Modifier and Type
Method
Description
`byte[]`
ClassFile.`build(ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)`
Builds a `class` file into a byte array using the provided constant pool builder.
`default byte[]`
ClassFile.`build(ClassDesc thisClass, Consumer<? super ClassBuilder> handler)`
Builds a `class` file into a byte array.
`default byte[]`
ClassFile.`buildModule(ModuleAttribute moduleAttribute, Consumer<? super ClassBuilder> handler)`
Builds a module descriptor into a byte array.
`default void`
ClassFile.`buildModuleTo(Path path, ModuleAttribute moduleAttribute, Consumer<? super ClassBuilder> handler)`
Builds a module descriptor into a file in a file system.
`default void`
ClassFile.`buildTo(Path path, ClassEntry thisClassEntry, ConstantPoolBuilder constantPool, Consumer<? super ClassBuilder> handler)`
Builds a `class` file into a file in a file system using the provided constant pool builder.
`default void`
ClassFile.`buildTo(Path path, ClassDesc thisClass, Consumer<ClassBuilder> handler)`
Builds a `class` file into a file in a file system.
`static ClassTransform`
ClassTransform.`endHandler(Consumer<ClassBuilder> finisher)`
Creates a class transform that passes each element through to the builder, and calls the specified function when transformation is complete.