java.lang.Object
jdk.jfr.EventType
Describes an event, its fields, settings and annotations.
- Since:
- 9
-
Method Summary
Modifier and TypeMethodDescription<A extends Annotation>
AgetAnnotation
(Class<A> annotationClass) Returns the first annotation for the specified type if an annotation element with the same name is directly present, otherwisenull
.Returns an immutable list of annotation elements for this event type.Returns the list of human-readable names that makes up the categories for this event type (for example,"Java Application"
,"Statistics"
).Returns a short sentence that describes the event class.static EventType
getEventType
(Class<? extends Event> eventClass) Returns the event type for an event class, ornull
if it doesn't exist.Returns the field with the specified name, ornull
if it doesn't exist.Returns an immutable list of descriptors that describe the event fields of this event type.long
getId()
Returns a unique ID for this event type in the Java Virtual Machine (JVM).getLabel()
Returns a human-readable name (for example,"CPU Load"
).getName()
Returns an identifier for the event (for example,"jdk.CPULoad"
).Returns an immutable list of the setting descriptors that describe the available event settings for this event type.boolean
Returnstrue
if the event is enabled and at least one recording is running,false
otherwise.
-
Method Details
-
getFields
Returns an immutable list of descriptors that describe the event fields of this event type.- Returns:
- the list of field descriptors, not
null
-
getField
Returns the field with the specified name, ornull
if it doesn't exist.It's possible to index into a nested field by using
"."
(for instance"thread.group.parent.name
").- Parameters:
name
- of the field to get, notnull
- Returns:
- a value descriptor that describes the field, or
null
if the field with the specified name doesn't exist
-
getName
Returns an identifier for the event (for example,"jdk.CPULoad"
).The identifier is the fully qualified name of the event class, if not set using the
Name
annotation.- Returns:
- the name, not
null
- See Also:
-
getLabel
Returns a human-readable name (for example,"CPU Load"
).The label of an event class can be set with
Label
.- Returns:
- the label, or
null
if a label is not set - See Also:
-
getId
public long getId()Returns a unique ID for this event type in the Java Virtual Machine (JVM).- Returns:
- the ID that is used in the JVM
-
getAnnotationElements
Returns an immutable list of annotation elements for this event type.- Returns:
- an immutable list of annotations or an empty list if no
annotations exists, not
null
-
isEnabled
public boolean isEnabled()Returnstrue
if the event is enabled and at least one recording is running,false
otherwise.By default, the event is enabled. The event can be enabled or disabled by setting the enabled setting to
true
orfalse
, programmatically or by using a configuration file. The event can also be disabled by annotating event with the@Enabled(false)
annotation.- Returns:
- true if event is enabled, false otherwise
- See Also:
-
getDescription
Returns a short sentence that describes the event class.The description of an event class can be set with
Description
.- Returns:
- the description, or
null
if no description exists - See Also:
-
getAnnotation
Returns the first annotation for the specified type if an annotation element with the same name is directly present, otherwisenull
.- Type Parameters:
A
- the type of the annotation to query for and return if present- Parameters:
annotationClass
- theClass
object that corresponds to the annotation type, notnull
- Returns:
- this element's annotation for the specified annotation type if
directly present, else
null
-
getEventType
Returns the event type for an event class, ornull
if it doesn't exist.- Parameters:
eventClass
- the event class, notnull
- Returns:
- the event class, or null if class doesn't exist
- Throws:
IllegalArgumentException
- ifeventClass
is an abstract classIllegalStateException
- if the class is annotated withRegistered(false)
, but not manually registered
-
getSettingDescriptors
Returns an immutable list of the setting descriptors that describe the available event settings for this event type.- Returns:
- the list of setting descriptors for this event type, not
null
-
getCategoryNames
Returns the list of human-readable names that makes up the categories for this event type (for example,"Java Application"
,"Statistics"
).- Returns:
- an immutable list of category names, or a list with the name
"Uncategorized"
if no category is set - See Also:
-