WritableElement (Java SE 23 & JDK 23)
Description: declaration: module: java.base, package: java.lang.classfile, interface: WritableElement
Keywords: java.lang.classfile.WritableElement interface

# Interface WritableElement<T>

Type Parameters:
  `T` - the type of the entity

All Superinterfaces:
  `ClassFileElementPREVIEW`

All Known Subinterfaces:
  `AnnotationPREVIEW`, `AnnotationConstantValueEntryPREVIEW`, `AnnotationDefaultAttributePREVIEW`, `AnnotationElementPREVIEW`, `AnnotationValuePREVIEW`, `AnnotationValue.OfAnnotationPREVIEW`, `AnnotationValue.OfArrayPREVIEW`, `AnnotationValue.OfBooleanPREVIEW`, `AnnotationValue.OfBytePREVIEW`, `AnnotationValue.OfCharacterPREVIEW`, `AnnotationValue.OfClassPREVIEW`, `AnnotationValue.OfConstantPREVIEW`, `AnnotationValue.OfDoublePREVIEW`, `AnnotationValue.OfEnumPREVIEW`, `AnnotationValue.OfFloatPREVIEW`, `AnnotationValue.OfIntegerPREVIEW`, `AnnotationValue.OfLongPREVIEW`, `AnnotationValue.OfShortPREVIEW`, `AnnotationValue.OfStringPREVIEW`, `AttributePREVIEW<A>`, `BootstrapMethodEntryPREVIEW`, `BootstrapMethodsAttributePREVIEW`, `CharacterRangeTableAttributePREVIEW`, `ClassEntryPREVIEW`, `CodeAttributePREVIEW`, `CompilationIDAttributePREVIEW`, `ConstantDynamicEntryPREVIEW`, `ConstantPoolBuilderPREVIEW`, `ConstantValueAttributePREVIEW`, `ConstantValueEntryPREVIEW`, `DeprecatedAttributePREVIEW`, `DoubleEntryPREVIEW`, `DynamicConstantPoolEntryPREVIEW`, `EnclosingMethodAttributePREVIEW`, `ExceptionsAttributePREVIEW`, `FieldModelPREVIEW`, `FieldRefEntryPREVIEW`, `FloatEntryPREVIEW`, `InnerClassesAttributePREVIEW`, `IntegerEntryPREVIEW`, `InterfaceMethodRefEntryPREVIEW`, `InvokeDynamicEntryPREVIEW`, `LineNumberTableAttributePREVIEW`, `LoadableConstantEntryPREVIEW`, `LocalVariableTableAttributePREVIEW`, `LocalVariableTypeTableAttributePREVIEW`, `LongEntryPREVIEW`, `MemberRefEntryPREVIEW`, `MethodHandleEntryPREVIEW`, `MethodModelPREVIEW`, `MethodParametersAttributePREVIEW`, `MethodRefEntryPREVIEW`, `MethodTypeEntryPREVIEW`, `ModuleAttributePREVIEW`, `ModuleEntryPREVIEW`, `ModuleHashesAttributePREVIEW`, `ModuleMainClassAttributePREVIEW`, `ModulePackagesAttributePREVIEW`, `ModuleResolutionAttributePREVIEW`, `ModuleTargetAttributePREVIEW`, `NameAndTypeEntryPREVIEW`, `NestHostAttributePREVIEW`, `NestMembersAttributePREVIEW`, `PackageEntryPREVIEW`, `PermittedSubclassesAttributePREVIEW`, `PoolEntryPREVIEW`, `RecordAttributePREVIEW`, `RuntimeInvisibleAnnotationsAttributePREVIEW`, `RuntimeInvisibleParameterAnnotationsAttributePREVIEW`, `RuntimeInvisibleTypeAnnotationsAttributePREVIEW`, `RuntimeVisibleAnnotationsAttributePREVIEW`, `RuntimeVisibleParameterAnnotationsAttributePREVIEW`, `RuntimeVisibleTypeAnnotationsAttributePREVIEW`, `SignatureAttributePREVIEW`, `SourceDebugExtensionAttributePREVIEW`, `SourceFileAttributePREVIEW`, `SourceIDAttributePREVIEW`, `StackMapTableAttributePREVIEW`, `StringEntryPREVIEW`, `SyntheticAttributePREVIEW`, `TypeAnnotationPREVIEW`, `UnknownAttributePREVIEW`, `Utf8EntryPREVIEW`

All Known Implementing Classes:
  `CustomAttributePREVIEW`

public sealed interface WritableElement<T> extends ClassFileElementPREVIEW permits AnnotationPREVIEW, AnnotationElementPREVIEW, AnnotationValuePREVIEW, AttributePREVIEW<A>, PoolEntryPREVIEW, BootstrapMethodEntryPREVIEW, FieldModelPREVIEW, MethodModelPREVIEW, ConstantPoolBuilderPREVIEW (not exhaustive)
`WritableElement` is a preview API of the Java platform.
Programs can only use `WritableElement` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
A classfile element that can encode itself as a stream of bytes in the encoding expected by the classfile format.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `writeTo(BufWriterPREVIEW buf)`
  Writes the element to the specified writer

- ## Method Details

  - ### writeTo

    void writeTo(BufWriterPREVIEW buf)
    Writes the element to the specified writer
    Parameters:
      `buf` - the writer