APIdia Launch Partner
Top Description Fields Methods
jdk.jfr

public @Interface DataAmount

extends Annotation
Annotations
@MetadataDefinition
@ContentType
@Label:Data Amount
@Description:Amount of data
@Retention:RUNTIME
@Target:FIELD, TYPE, METHOD
Imports
java.lang.annotation.ElementType, .Retention, .RetentionPolicy, .Target

Event field annotation, specifies that a value represents an amount of data (for example, bytes).

The following example shows how the DataAmount annotation can be used to set the units BITS and BYTES to event fields.

@Name("com.example.ImageRender") @Label("Image Render") public class ImageRender extends Event { @Label("Height") long height; @Label("Width") long width; @Label("Color Depth") @DataAmount(DataAmount.BITS) int colorDepth; @Label("Memory Size") @DataAmount // bytes by default long memorySize; }
@Name("com.example.ImageRender")
@Label("Image Render")
public class ImageRender extends Event {
    @Label("Height")
    long height;

    @Label("Width")
    long width;

    @Label("Color Depth")
    @DataAmount(DataAmount.BITS)
    int colorDepth;

    @Label("Memory Size")
    @DataAmount // bytes by default
    long memorySize;
}
Since
9

Field Summary

Modifier and TypeField and Description
public static final String
BITS

Unit for bits

public static final String
BYTES

Unit for bytes

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the data amount unit, default BYTES
value
()

Returns the unit for the data amount, by default bytes.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Field Detail

BITSback to summary
public static final String BITS

Unit for bits

BYTESback to summary
public static final String BYTES

Unit for bytes

Method Detail

valueback to summary
public String value()

Returns the unit for the data amount, by default bytes.

Returns:String

the data amount unit, default BYTES