Top Fields Constructors Methods
jdk.internal.classfile.impl

public final Class ChainedClassBuilder

extends Object
implements ClassBuilder, Consumer<ClassElement>
Class Inheritance
All Implemented Interfaces
java.util.function.Consumer, java.lang.classfile.ClassBuilder, java.lang.classfile.ClassFileBuilder
Imports
java.util.Optional, java.util.function.Consumer, java.lang.classfile.*, java.lang.classfile.constantpool.ConstantPoolBuilder, .Utf8Entry

Field Summary

Modifier and TypeField and Description
private final Consumer<ClassElement>
private final DirectClassBuilder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ConstantPoolBuilder
constantPool()

Implements java.lang.classfile.ClassFileBuilder.constantPool.

Returns the constant pool builder associated with this builder.

public Optional<ClassModel>
original()

Implements java.lang.classfile.ClassBuilder.original.

Returns the ClassModel representing the class being transformed, if this class builder represents the transformation of some ClassModel.

public ClassBuilder
transformField(FieldModel
the field to be transformed
field
,
FieldTransform
the transform to apply to the field
transform
)

Implements java.lang.classfile.ClassBuilder.transformField.

Adds a field by transforming a field from another class.

public ClassBuilder
transformMethod(MethodModel
the method to be transformed
method
,
MethodTransform
the transform to apply to the method
transform
)

Implements java.lang.classfile.ClassBuilder.transformMethod.

Adds a method by transforming a method from another class.

public ClassBuilder
with(ClassElement
the element
element
)

Implements java.lang.classfile.ClassFileBuilder.with.

Integrate the ClassFileElement into the entity being built.

public ClassBuilder
withField(Utf8Entry
the name of the field
name
,
Utf8Entry
the field descriptor
descriptor
,
Consumer<? super FieldBuilder>
handler which receives a FieldBuilder which can further define the contents of the field
handler
)

Implements java.lang.classfile.ClassBuilder.withField.

Adds a field.

public ClassBuilder
withMethod(Utf8Entry
the name of the method
name
,
Utf8Entry
the method descriptor
descriptor
,
int
the access flags
flags
,
Consumer<? super MethodBuilder>
handler which receives a MethodBuilder which can further define the contents of the method
handler
)

Implements java.lang.classfile.ClassBuilder.withMethod.

Adds a method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

consumerback to summary
private final Consumer<ClassElement> consumer
terminalback to summary
private final DirectClassBuilder terminal

Constructor Detail

ChainedClassBuilderback to summary
public ChainedClassBuilder(ClassBuilder downstream, Consumer<ClassElement> consumer)

Method Detail

constantPoolback to summary
public ConstantPoolBuilder constantPool()

Implements java.lang.classfile.ClassFileBuilder.constantPool.

Doc from java.lang.classfile.ClassFileBuilder.constantPool.

Returns the constant pool builder associated with this builder.

Returns:ConstantPoolBuilder

the constant pool builder associated with this builder

Annotations
@Override
originalback to summary
public Optional<ClassModel> original()

Implements java.lang.classfile.ClassBuilder.original.

Doc from java.lang.classfile.ClassBuilder.original.

Returns the ClassModel representing the class being transformed, if this class builder represents the transformation of some ClassModel.

Returns:Optional<ClassModel>

the ClassModel representing the class being transformed, if this class builder represents the transformation of some ClassModel

Annotations
@Override
transformFieldback to summary
public ClassBuilder transformField(FieldModel field, FieldTransform transform)

Implements java.lang.classfile.ClassBuilder.transformField.

Doc from java.lang.classfile.ClassBuilder.transformField.

Adds a field by transforming a field from another class.

Parameters
field:FieldModel

the field to be transformed

transform:FieldTransform

the transform to apply to the field

Returns:ClassBuilder

this builder

Annotations
@Override
transformMethodback to summary
public ClassBuilder transformMethod(MethodModel method, MethodTransform transform)

Implements java.lang.classfile.ClassBuilder.transformMethod.

Doc from java.lang.classfile.ClassBuilder.transformMethod.

Adds a method by transforming a method from another class.

Parameters
method:MethodModel

the method to be transformed

transform:MethodTransform

the transform to apply to the method

Returns:ClassBuilder

this builder

Annotations
@Override
withback to summary
public ClassBuilder with(ClassElement element)

Implements java.lang.classfile.ClassFileBuilder.with.

Doc from java.lang.classfile.ClassFileBuilder.with.

Integrate the ClassFileElement into the entity being built.

Parameters
element:ClassElement

the element

Returns:ClassBuilder

this builder

Annotations
@Override
withFieldback to summary
public ClassBuilder withField(Utf8Entry name, Utf8Entry descriptor, Consumer<? super FieldBuilder> handler)

Implements java.lang.classfile.ClassBuilder.withField.

Doc from java.lang.classfile.ClassBuilder.withField.

Adds a field.

Parameters
name:Utf8Entry

the name of the field

descriptor:Utf8Entry

the field descriptor

handler:Consumer<? super FieldBuilder>

handler which receives a FieldBuilder which can further define the contents of the field

Returns:ClassBuilder

this builder

Annotations
@Override
withMethodback to summary
public ClassBuilder withMethod(Utf8Entry name, Utf8Entry descriptor, int flags, Consumer<? super MethodBuilder> handler)

Implements java.lang.classfile.ClassBuilder.withMethod.

Doc from java.lang.classfile.ClassBuilder.withMethod.

Adds a method.

Parameters
name:Utf8Entry

the name of the method

descriptor:Utf8Entry

the method descriptor

flags:int

the access flags

handler:Consumer<? super MethodBuilder>

handler which receives a MethodBuilder which can further define the contents of the method

Returns:ClassBuilder

this builder

Annotations
@Override