AttributedElement, ClassElement, ClassFileElement, CompoundElement<FieldElement>, Iterable<FieldElement>public sealed interface FieldModel extends CompoundElement<FieldElement>, AttributedElement, ClassElement
FieldElements, or by random access via accessor methods if only specific parts of the field is needed. Fields can be obtained from ClassModel.fields(), or in the traversal of member elements of a class.
ClassBuilder.withField(String, ClassDesc, Consumer) is the main way to construct fields. ClassBuilder.transformField(FieldModel, FieldTransform) allows creating a new field by selectively processing the original field elements and directing the results to a field builder.
All field attributes are accessible as member elements.
| Modifier and Type | Method | Description |
|---|---|---|
Utf8Entry |
fieldName() |
Returns the name of this field. |
Utf8Entry |
fieldType() |
Returns the field descriptor string of this field. |
default ClassDesc |
fieldTypeSymbol() |
Returns the field type, as a symbolic descriptor. |
AccessFlags |
flags() |
Returns the access flags. |
Optional |
parent() |
Returns the class model this field is a member of, if known. |
attributes, findAttribute, findAttributes
elementList, elementStream, forEach, iterator, toDebugString
spliterator
AccessFlags flags()
Optional<ClassModel> parent()
Utf8Entry fieldName()
Utf8Entry fieldType()
default ClassDesc fieldTypeSymbol()
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/FieldModel.html