- java.lang.Object
 -  
      
- jdk.jfr.EventType
 
 
-  
       
public final class EventType extends Object
描述事件,其字段,设置和注释。- 从以下版本开始:
 - 9
 
 
-  
        
       
-  
             
方法摘要
所有方法 静态方法 实例方法 具体的方法 变量和类型 方法 描述 <A extends Annotation>
AgetAnnotation(类<A> annotationClass)如果直接存在具有相同名称的注释元素,则返回指定类型的第一个注释,否则null。List<AnnotationElement>getAnnotationElements()返回此事件类型的注释元素的不可变列表。List<String>getCategoryNames()返回拼成的类别对这种事件类型(例如,人类可读的名称列表"Java Application","Statistics")。StringgetDescription()返回描述事件类的短句。static EventTypegetEventType(类<? extends Event> eventClass)返回事件类的事件类型,如果不存在,则返回null。ValueDescriptorgetField(String name)返回具有指定名称的字段,如果不存在,则返回null。List<ValueDescriptor>getFields()返回描述此事件类型的事件字段的不可变描述符列表。longgetId()在Java虚拟机(JVM)中返回此事件类型的唯一ID。StringgetLabel()返回一个人类可读的名称(例如,"CPU Load")。StringgetName()返回事件的标识符(例如,"jdk.CPULoad")。List<SettingDescriptor>getSettingDescriptors()返回描述此事件类型的可用事件设置的设置描述符的不可变列表。booleanisEnabled()返回true如果启用了事件和至少一个录制时,false否则。 
 -  
             
 
-  
        
       
-  
             
方法详细信息
-  
getFields
public List<ValueDescriptor> getFields()
返回描述此事件类型的事件字段的不可变描述符列表。- 结果
 -  
              
null列表,而不是null 
 
-  
getField
public ValueDescriptor getField(String name)
返回具有指定名称的字段,如果不存在,则返回null。- 结果
 - 
               描述该字段的值描述符,如果不存在具有指定名称的字段, 
              
null 
 
-  
getName
public String getName()
返回事件的标识符(例如,"jdk.CPULoad")。如果未使用
Name批注设置,则标识符是事件类的完全限定名称。- 结果
 - 
               这个名字,不是 
              
null - 另请参见:
 -  
              
Name 
 
-  
getLabel
public String getLabel()
返回一个人类可读的名称(例如,"CPU Load")。可以使用
Label设置事件类的标签。- 结果
 - 
               标签,如果未设置标签, 
              
null - 另请参见:
 -  
              
Label 
 
-  
getId
public long getId()
在Java虚拟机(JVM)中返回此事件类型的唯一ID。- 结果
 - JVM中使用的ID
 
 
-  
getAnnotationElements
public List<AnnotationElement> getAnnotationElements()
返回此事件类型的注释元素的不可变列表。- 结果
 - 
               如果没有注释, 
              
null不可变的注释列表或空列表,而不是null 
 
-  
isEnabled
public boolean isEnabled()
返回true如果启用了事件和至少一个录制时,false否则。默认情况下,启用该事件。 可以通过以编程方式或使用配置文件将启用的设置设置为
true或false来启用或禁用该事件。 也可以通过使用@Enabled(false)注释注释事件来禁用该事件。- 结果
 - 如果启用了event,则返回true,否则返回false
 - 另请参见:
 -  
              
Enabled,Recording.enable(Class) 
 
-  
getDescription
public String getDescription()
返回描述事件类的短句。可以使用
描述设置事件类的描述。- 结果
 - 
               描述,或 
              
null如果不存在描述 - 另请参见:
 -  
              
描述 
 
-  
getAnnotation
public <A extends Annotation> A getAnnotation(类<A> annotationClass)
如果直接存在具有相同名称的注释元素,则返回指定类型的第一个注释,否则null。- 参数类型
 -  
              
A- 要查询的注释的类型,如果存在则返回 - 参数
 -  
              
annotationClass- 对应于注释类型的类对象,而不是null - 结果
 - 
               如果直接存在,则此元素的指定注释类型的注释,否则为 
              
null 
 
-  
getEventType
public static EventType getEventType(类<? extends Event> eventClass)
返回事件类的事件类型,如果不存在,则返回null。- 参数
 -  
              
eventClass- 事件类,而不是null - 结果
 - 事件类,如果类不存在,则返回null
 - 异常
 -  
              
IllegalArgumentException- 如果eventClass是一个抽象类 -  
              
IllegalStateException- 如果类使用Registered(false)注释,但未手动注册 
 
-  
getSettingDescriptors
public List<SettingDescriptor> getSettingDescriptors()
返回描述此事件类型的可用事件设置的设置描述符的不可变列表。- 结果
 - 
               此事件类型的设置描述符列表,而不是 
              
null 
 
 -  
 
 -