Package Summary Overview Summary

Module java.base
Package java.lang.classfile.attributePREVIEW

# Interface SourceIDAttribute

All Superinterfaces:
  `AttributePREVIEW<SourceIDAttributePREVIEW>`, `ClassElementPREVIEW`, `ClassFileElementPREVIEW`, `WritableElementPREVIEW<SourceIDAttributePREVIEW>`

public sealed interface SourceIDAttribute extends AttributePREVIEW<SourceIDAttributePREVIEW>, ClassElementPREVIEW
`SourceIDAttribute` is a preview API of the Java platform.
Programs can only use `SourceIDAttribute` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models the `SourceID` attribute, which can appear on classes. Delivered as a `ClassElement`PREVIEW when traversing a `ClassModel`PREVIEW.

The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static SourceIDAttributePREVIEW`
  `of (Utf8EntryPREVIEW sourceId)`
  Returns a `SourceID` attribute.
  `static SourceIDAttributePREVIEW`
  `of (String sourceId)`
  Returns a `SourceID` attribute.
  `Utf8EntryPREVIEW`
  `sourceId()`
  Returns the source id.

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

  `attributeMapper, attributeName`

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

  `writeTo`

- ## Method Details

  - ### sourceId

    Utf8EntryPREVIEW sourceId()
    Returns the source id. The source id is the last modified time of the source file (as reported by the filesystem, in milliseconds) when the classfile is compiled.
    Returns:
      the source id

  - ### of

    static SourceIDAttributePREVIEW of (Utf8EntryPREVIEW sourceId)
    Returns a `SourceID` attribute.
    Parameters:
      `sourceId` - the source id
    Returns:
      a `SourceID` attribute

  - ### of

    static SourceIDAttributePREVIEW of (String sourceId)
    Returns a `SourceID` attribute.
    Parameters:
      `sourceId` - the source id
    Returns:
      a `SourceID` attribute