Package Summary Overview Summary

Module java.base
Package java.lang.classfilePREVIEW

# Interface FieldModel

All Superinterfaces:
  `AttributedElementPREVIEW`, `ClassElementPREVIEW`, `ClassFileElementPREVIEW`, `CompoundElementPREVIEW<FieldElementPREVIEW>`, `Iterable<FieldElementPREVIEW>`, `WritableElementPREVIEW<FieldModelPREVIEW>`

public sealed interface FieldModel extends WritableElementPREVIEW<FieldModelPREVIEW>, CompoundElementPREVIEW<FieldElementPREVIEW>, AttributedElementPREVIEW, ClassElementPREVIEW
`FieldModel` is a preview API of the Java platform.
Programs can only use `FieldModel` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a field. The contents of the field can be traversed via a streaming view (e.g., `CompoundElement.elements()`PREVIEW), or via random access (e.g., `flags()`), or by freely mixing the two.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Utf8EntryPREVIEW`
  `fieldName()`
  Returns the name of this field.
  `Utf8EntryPREVIEW`
  `fieldType()`
  Returns the field descriptor of this field.
  `default ClassDesc`
  `fieldTypeSymbol()`
  Returns the field descriptor of this field, as a symbolic descriptor.
  `AccessFlagsPREVIEW`
  `flags()`
  Returns the access flags.
  `Optional <ClassModelPREVIEW>`
  `parent()`
  Returns the class model this field is a member of, if known.

  ### Methods declared in interface java.lang.classfile.AttributedElementPREVIEW

  `attributes, findAttribute, findAttributes`

  ### Methods declared in interface java.lang.classfile.CompoundElementPREVIEW

  `elementList, elements, elementStream, forEachElement, iterator`

  ### Methods declared in interface java.lang.Iterable

  `forEach, spliterator`

  ### Methods declared in interface java.lang.classfile.WritableElementPREVIEW

  `writeTo`

- ## Method Details

  - ### flags

    AccessFlagsPREVIEW flags()
    Returns the access flags.
    Returns:
      the access flags

  - ### parent

    Optional<ClassModelPREVIEW> parent()
    Returns the class model this field is a member of, if known.
    Returns:
      the class model this field is a member of, if known

  - ### fieldName

    Utf8EntryPREVIEW fieldName()
    Returns the name of this field.
    Returns:
      the name of this field

  - ### fieldType

    Utf8EntryPREVIEW fieldType()
    Returns the field descriptor of this field.
    Returns:
      the field descriptor of this field

  - ### fieldTypeSymbol

    default ClassDesc fieldTypeSymbol()
    Returns the field descriptor of this field, as a symbolic descriptor.
    Returns:
      the field descriptor of this field, as a symbolic descriptor