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(); }
| Modifier and Type | Field and Description |
|---|---|
| private Map | |
| private String | |
| private final PlatformEventType | |
| private static final String[] | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public < the type of the annotation to query for and return if present A extends Annotation> A | Returns: this element's annotation for the specified annotation type if directly present, elsenullthe annotationClass)Class object that corresponds to the
annotation type, not nullReturns the first annotation for the specified type if an annotation
element with the same name is directly present, otherwise |
| public List | Returns: an immutable list of annotations or an empty list if no annotations exists, notnullReturns an immutable list of annotation elements for this event type. |
| public List | Returns: an immutable list of category names, or a list with the name"Uncategorized" if no category is setReturns the list of human-readable names that make up the categories for
this event type (for example, |
| public String | Returns: the description, ornull if no description existsReturns a short sentence that describes the event class. |
| public static EventType | Returns: the event class, or null if class doesn't existthe event class, not eventClass)nullReturns the event type for an event class, or |
| public ValueDescriptor | |
| public List | Returns: the list of field descriptors, notnullReturns an immutable list of descriptors that describe the event fields of this event type. |
| public long | Returns: the ID that is used in the JVMReturns a unique ID for this event type in the Java Virtual Machine (JVM). |
| public String | Returns: the label, ornull if a label is not setReturns a human-readable name (for example, |
| public String | Returns: the name, notnullReturns an identifier for the event (for example,
|
| pack-priv PlatformEventType | |
| public List | Returns: the list of setting descriptors for this event type, notnullReturns an immutable list of the setting descriptors that describe the available event settings for this event type. |
| pack-priv Type | |
| public boolean | Returns: true if event is enabled, false otherwiseReturns |
| pack-priv boolean |
| cache | back to summary |
|---|---|
| private Map<String, ValueDescriptor> cache | |
| label | back to summary |
|---|---|
| private String label | |
| platformEventType | back to summary |
|---|---|
| private final PlatformEventType platformEventType | |
| UNCATEGORIZED | back to summary |
|---|---|
| private static final String[] UNCATEGORIZED | |
| UNKNOWN | back to summary |
|---|---|
| private static final String UNKNOWN | |
| EventType | back to summary |
|---|---|
| pack-priv EventType(PlatformEventType platformEventType) | |
| getAnnotation | back to summary |
|---|---|
| public <A extends Annotation> A getAnnotation(Class<A> annotationClass) Returns the first annotation for the specified type if an annotation
element with the same name is directly present, otherwise
| |
| getAnnotationElements | back to summary |
|---|---|
| public List Returns an immutable list of annotation elements for this event type.
| |
| getCategoryNames | back to summary |
|---|---|
| public List Returns the list of human-readable names that make up the categories for
this event type (for example, | |
| getDescription | back to summary |
|---|---|
| public String getDescription() Returns a short sentence that describes the event class.
The description of an event class can be set with
| |
| getEventType | back to summary |
|---|---|
| public static EventType getEventType(Class<? extends Event> eventClass) Returns the event type for an event class, or
| |
| getField | back to summary |
|---|---|
| public ValueDescriptor getField(String name) Returns the field with the specified name, or
It's possible to index into a nested field by using
| |
| getFields | back to summary |
|---|---|
| public List Returns an immutable list of descriptors that describe the event fields of this event type.
| |
| getId | back to summary |
|---|---|
| public long getId() Returns a unique ID for this event type in the Java Virtual Machine (JVM).
| |
| getLabel | back to summary |
|---|---|
| public String getLabel() Returns a human-readable name (for example,
The label of an event class can be set with | |
| getName | back to summary |
|---|---|
| public String getName() Returns an identifier for the event (for example,
The identifier is the fully qualified name of the event class, if not set using
the | |
| getPlatformEventType | back to summary |
|---|---|
| pack-priv PlatformEventType getPlatformEventType() | |
| getSettingDescriptors | back to summary |
|---|---|
| public List Returns an immutable list of the setting descriptors that describe the available event settings for this event type.
| |
| getType | back to summary |
|---|---|
| pack-priv Type getType() | |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled() Returns
By default, the event is enabled. The event can be enabled or disabled by
setting the enabled setting to
| |
| isVisible | back to summary |
|---|---|
| pack-priv boolean isVisible() | |