Top Description Methods
java.lang.classfile

public sealed Interface FieldBuilder

extends ClassFileBuilder<FieldElement, FieldBuilder>
Known Direct Subinterfaces
jdk.internal.classfile.impl.TerminalFieldBuilder
Known Direct Implementers
jdk.internal.classfile.impl.ChainedFieldBuilder
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.classfile.constantpool.Utf8Entry, jdk.internal.classfile.impl.ChainedFieldBuilder, .TerminalFieldBuilder, java.lang.reflect.AccessFlag, java.util.Optional, java.util.function.Consumer, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use FieldBuilder when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

A builder for fields. Builders are not created directly; they are passed to handlers by methods such as ClassBuilder#withField(Utf8Entry, Utf8Entry, Consumer) or to field transforms. The elements of a field can be specified abstractly (by passing a FieldElement to with(ClassFileElement) or concretely by calling the various withXxx methods.
Since
22
See Also
FieldTransform

Method Summary

Modifier and TypeMethod and Description
public Optional<FieldModel>

Returns:

the FieldModel representing the field being transformed, if this field builder represents the transformation of some FieldModel
original
()

Returns the FieldModel representing the field being transformed, if this field builder represents the transformation of some FieldModel.

public default FieldBuilder

Returns:

this builder
withFlags
(int
the access flags, as a bit mask
flags
)

Sets the field access flags.

public default FieldBuilder

Returns:

this builder
withFlags
(AccessFlag...
the access flags, as a bit mask
flags
)

Sets the field access flags.

Inherited from java.lang.classfile.ClassFileBuilder:
acceptcanWriteDirectconstantPooltransformwith

Method Detail

originalback to summary
public Optional<FieldModel> original()

Returns the FieldModel representing the field being transformed, if this field builder represents the transformation of some FieldModel.

Returns:Optional<FieldModel>

the FieldModel representing the field being transformed, if this field builder represents the transformation of some FieldModel

withFlagsback to summary
public default FieldBuilder withFlags(int flags)

Sets the field access flags.

Parameters
flags:int

the access flags, as a bit mask

Returns:FieldBuilder

this builder

withFlagsback to summary
public default FieldBuilder withFlags(AccessFlag... flags)

Sets the field access flags.

Parameters
flags:AccessFlag[]

the access flags, as a bit mask

Returns:FieldBuilder

this builder