Module jdk.jfr
Package jdk.jfr

Class EventType

java.lang.Object
jdk.jfr.EventType

public final class EventType extends Object
Describes an event, its fields, settings and annotations.

The following example shows how the EventType class can be used to print metadata about an event.

for (EventType eventType : FlightRecorder.getFlightRecorder().getEventTypes()) {
    System.out.println("Event Type: " + eventType.getName());
    if (eventType.getLabel() != null) {
        System.out.println("Label: " + eventType.getLabel());
    }
    if (eventType.getDescription() != null) {
        System.out.println("Description: " + eventType.getDescription());
    }
    StringJoiner s = new StringJoiner(" / ");
    for (String category : eventType.getCategoryNames()) {
        s.add(category);
    }
    System.out.println("Category: " + s);
    System.out.println("Fields: " + eventType.getFields().size());
    System.out.println("Annotations: " + eventType.getAnnotationElements().size());
    System.out.println("Settings: " + eventType.getSettingDescriptors().size());
    System.out.println("Enabled: " + eventType.isEnabled());
    System.out.println();
}
Since:
9