class file. ClassFile provides different
build methods that accept handlers to configure such a builder;
ClassFile#build(ClassDesc, Consumer) suffices for basic usage, while
ClassFile#build(ClassEntry, ConstantPoolBuilder, Consumer) allows
fine-grained control over the
constant pool.
Refer to ClassFileBuilder for general guidance and caution around
the use of builders for structures in the class file format.
ClassFile#build(ClassEntry, ConstantPoolBuilder, Consumer), ClassModel, ClassTransform
| Modifier and Type | Method and Description |
|---|---|
| public ClassBuilder | Returns: this builderthe field to be transformed field, FieldTransform the transform to apply to the field transform)Adds a field by transforming a field from another class. |
| public ClassBuilder | Returns: this builderthe method to be transformed method, MethodTransform the transform to apply to the method transform)Adds a method by transforming a method from another class. |
| public ClassBuilder | Returns: this builderthe field name name, Utf8Entry the field descriptor string descriptor, Consumer<? super FieldBuilder> handler to supply the contents of the field handler)Adds a field. |
| public default ClassBuilder | |
| public default ClassBuilder | Returns: this builderthe field name name, ClassDesc the symbolic field descriptor descriptor, Consumer<? super FieldBuilder> handler to supply the contents of the field handler)Adds a field. |
| public default ClassBuilder | |
| public default ClassBuilder | Returns: this builderthe access flags, as a bit mask flags)Sets the access flags of this class. |
| public default ClassBuilder | Returns: this builderthe access flags, as flag enums flags)Sets the access flags of this class. |
| public default ClassBuilder | Returns: this builderthe interfaces interfaces)Sets the interfaces of this class. |
| public default ClassBuilder | Returns: this builderthe interfaces interfaces)Sets the interfaces of this class. |
| public default ClassBuilder | Returns: this builderthe interfaces interfaces)Sets the interfaces of this class. |
| public default ClassBuilder | Returns: this builderthe interfaces interfaces)Sets the interfaces of this class. |
| public ClassBuilder | Returns: this builderthe method name name, Utf8Entry the method descriptor descriptor, int the access flags as a bit mask, with the methodFlags, Consumer<? super MethodBuilder> ACC_STATIC bit definitely sethandler to supply the contents of the method handler)Adds a method. |
| public default ClassBuilder | Returns: this builderthe method name name, MethodTypeDesc the method descriptor descriptor, int the access flags as a bit mask, with the methodFlags, Consumer<? super MethodBuilder> ACC_STATIC bit definitely sethandler to supply the contents of the method handler)Adds a method. |
| public default ClassBuilder | Returns: this builderthe method name name, Utf8Entry the method descriptor descriptor, int the access flags as a bit mask, with the methodFlags, Consumer<? super CodeBuilder> ACC_STATIC bit definitely sethandler to supply the contents of the method body handler)Adds a method, with only access flags and a |
| public default ClassBuilder | Returns: this builderthe method name name, MethodTypeDesc the method descriptor descriptor, int the access flags as a bit mask, with the methodFlags, Consumer<? super CodeBuilder> ACC_STATIC bit definitely sethandler to supply the contents of the method body handler)Adds a method, with only access flags and a |
| public default ClassBuilder | Returns: this builderthe superclass superclassEntry)Sets the superclass of this class. |
| public default ClassBuilder | |
| public default ClassBuilder | Returns: this builderthe major version number major, int the minor version number minor)Sets the version of this class. |
| transformField | back to summary |
|---|---|
| public ClassBuilder transformField(FieldModel field, FieldTransform transform) Adds a field by transforming a field from another class. This method behaves as if:
| |
| transformMethod | back to summary |
|---|---|
| public ClassBuilder transformMethod(MethodModel method, MethodTransform transform) Adds a method by transforming a method from another class. The transform
cannot modify the This method behaves as if: withMethod(method.methodName(), method.methodType(), method.flags().flagMask(), mb -> mb.transform(method, transform))
| |
| withField | back to summary |
|---|---|
| public ClassBuilder withField(Utf8Entry name, Utf8Entry descriptor, Consumer<? super FieldBuilder> handler) Adds a field.
| |
| withField | back to summary |
|---|---|
| public default ClassBuilder withField(Utf8Entry name, Utf8Entry descriptor, int flags) Adds a field, with only access flags.
| |
| withField | back to summary |
|---|---|
| public default ClassBuilder withField(String name, ClassDesc descriptor, Consumer<? super FieldBuilder> handler) Adds a field.
| |
| withField | back to summary |
|---|---|
| public default ClassBuilder withField(String name, ClassDesc descriptor, int flags) Adds a field, with only access flags.
| |
| withFlags | back to summary |
|---|---|
| public default ClassBuilder withFlags(int flags) Sets the access flags of this class.
| |
| withFlags | back to summary |
|---|---|
| public default ClassBuilder withFlags(AccessFlag... flags) Sets the access flags of this class.
| |
| withInterfaces | back to summary |
|---|---|
| public default ClassBuilder withInterfaces(List<ClassEntry> interfaces) Sets the interfaces of this class.
| |
| withInterfaces | back to summary |
|---|---|
| public default ClassBuilder withInterfaces(ClassEntry... interfaces) Sets the interfaces of this class.
| |
| withInterfaceSymbols | back to summary |
|---|---|
| public default ClassBuilder withInterfaceSymbols(List<ClassDesc> interfaces) Sets the interfaces of this class.
| |
| withInterfaceSymbols | back to summary |
|---|---|
| public default ClassBuilder withInterfaceSymbols(ClassDesc... interfaces) Sets the interfaces of this class.
| |
| withMethod | back to summary |
|---|---|
| public ClassBuilder withMethod(Utf8Entry name, Utf8Entry descriptor, int methodFlags, Consumer<? super MethodBuilder> handler) Adds a method. The bit for
| |
| withMethod | back to summary |
|---|---|
| public default ClassBuilder withMethod(String name, MethodTypeDesc descriptor, int methodFlags, Consumer<? super MethodBuilder> handler) Adds a method. The bit for
| |
| withMethodBody | back to summary |
|---|---|
| public default ClassBuilder withMethodBody(Utf8Entry name, Utf8Entry descriptor, int methodFlags, Consumer<? super CodeBuilder> handler) Adds a method, with only access flags and a This method behaves as if: withMethod(name, descriptor, methodFlags, mb -> mb.withCode(handler))
| |
| withMethodBody | back to summary |
|---|---|
| public default ClassBuilder withMethodBody(String name, MethodTypeDesc descriptor, int methodFlags, Consumer<? super CodeBuilder> handler) Adds a method, with only access flags and a This method behaves as if: withMethod(name, descriptor, methodFlags, mb -> mb.withCode(handler))
| |
| withSuperclass | back to summary |
|---|---|
| public default ClassBuilder withSuperclass(ClassEntry superclassEntry) Sets the superclass of this class.
| |
| withSuperclass | back to summary |
|---|---|
| public default ClassBuilder withSuperclass(ClassDesc desc) Sets the superclass of this class.
| |
| withVersion | back to summary |
|---|---|
| public default ClassBuilder withVersion(int major, int minor) Sets the version of this class.
| |