Top Description Methods
java.lang.classfile.attribute

public sealed Interface SourceIDAttribute

extends Attribute<SourceIDAttribute>, ClassElement
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundSourceIDAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundSourceIDAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.classfile.Attribute, .ClassElement, .ClassModel, java.lang.classfile.constantpool.Utf8Entry, jdk.internal.classfile.impl.BoundAttribute, .TemporaryConstantPool, .UnboundAttribute, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

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 java.lang.classfile.ClassElement when traversing a ClassModel.

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 TypeMethod and Description
public static SourceIDAttribute

Returns:

a SourceID attribute
of
(Utf8Entry
the source id
sourceId
)

Returns a SourceID attribute.

public static SourceIDAttribute

Returns:

a SourceID attribute
of
(String
the source id
sourceId
)

Returns a SourceID attribute.

public Utf8Entry

Returns:

the source id
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.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

ofback to summary
public static SourceIDAttribute of(Utf8Entry sourceId)

Returns a SourceID attribute.

Parameters
sourceId:Utf8Entry

the source id

Returns:SourceIDAttribute

a SourceID attribute

ofback to summary
public static SourceIDAttribute of(String sourceId)

Returns a SourceID attribute.

Parameters
sourceId:String

the source id

Returns:SourceIDAttribute

a SourceID attribute

sourceIdback to summary
public Utf8Entry 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:Utf8Entry

the source id