- java.lang.Object
-  
      - jdk.jfr.ValueDescriptor
 
-  
       
 public final class ValueDescriptor extends Object 描述事件字段和注释元素。- 从以下版本开始:
- 9
 
-  
        
       -  
             构造方法摘要构造方法 构造器 描述 ValueDescriptor(类<?> type, String name)构造一个值描述符,用于动态创建事件类型和注释。ValueDescriptor(类<?> type, String name, List<AnnotationElement> annotations)构造一个值描述符,用于动态创建事件类型和注释。
 -  
             方法摘要所有方法 实例方法 具体的方法 变量和类型 方法 描述 <A extends Annotation>
 AgetAnnotation(类<A> annotationType)如果具有相同名称的注释元素直接存在于此值描述符,则返回指定类型的第一个注释,否则null。List<AnnotationElement>getAnnotationElements()返回此值描述符的注释元素的不可变列表。StringgetContentType()返回一个文本标识符,指定如何解释或格式化此ValueDescriptor表示的值。StringgetDescription()返回描述该值的句子(例如,"Maximum throughput in the transaction system. Value is reset after each new batch.")。List<ValueDescriptor>getFields()如果类型是复杂的,则返回值描述符的不可变列表,否则返回空列表。StringgetLabel()返回描述该值的可读名称(例如,"Maximum Throughput")。StringgetName()返回值的名称(例如,"maxThroughput")。longgetTypeId()返回Java虚拟机(JVM)中类型的唯一ID。StringgetTypeName()返回与此值描述符关联的类型的完全限定类名。booleanisArray()返回此值描述符是否为数组类型。
 
-  
             
-  
        
       -  
             构造方法详细信息-  ValueDescriptorpublic ValueDescriptor(类<?> type, String name) 构造一个值描述符,用于动态创建事件类型和注释。 支持以下类型: -  byte.class
-  short.class
-  int.class
-  long.class
-  char.class
-  float.class
-  double.class
-  boolean.class
-  String.class
-  Class.class
-  Thread.class
 该名称必须是有效的Java标识符(例如, "maxThroughput")。 有关更多信息,请参见3.8 Java语言规范。- 参数
-  
              type- 类型,而不是null
-  
              name- 名称,而不是null
- 异常
-  
              SecurityException- 如果存在安全管理器且呼叫者没有FlightRecorderPermission("registerEvent")
 
-  
 -  ValueDescriptorpublic ValueDescriptor(类<?> type, String name, List<AnnotationElement> annotations) 构造一个值描述符,用于动态创建事件类型和注释。 支持以下类型: -  byte.class
-  short.class
-  int.class
-  long.class
-  char.class
-  float.class
-  double.class
-  boolean.class
-  String.class
-  Class.class
-  Thread.class
 该名称必须是有效的Java标识符(例如, "maxThroughput")。 有关更多信息,请参见3.8 Java语言规范。- 参数
-  
              type- 类型,而不是null
-  
              name- 名称,而不是null
-  
              annotations- 值描述符上的注释,而不是null
- 异常
-  
              SecurityException- 如果存在安全管理器且调用者没有FlightRecorderPermission("registerEvent")
 
-  
 
-  
 -  
             方法详细信息-  getLabelpublic String getLabel() 返回描述该值的可读名称(例如,"Maximum Throughput")。- 结果
- 
               一个人类可读的名称,如果不存在 
              null
 
 -  getNamepublic String getName() 返回值的名称(例如,"maxThroughput")。- 结果
- 
               这个名字,不是 
              null
 
 -  getDescriptionpublic String getDescription() 返回描述该值的句子(例如,"Maximum throughput in the transaction system. Value is reset after each new batch.")。- 结果
- 
               描述,或 
              null如果不存在
 
 -  getContentTypepublic String getContentType() 返回一个文本标识符,指定如何解释或格式化此ValueDescriptor表示的值。例如,如果值描述符的类型为 float且事件值为0.5f,则内容类型为"jdk.jfr.Percentage"向客户端提示该值为百分比,并且应将其呈现为"50%"。JDK提供以下预定义内容类型: - jdk.jfr.Percentage
- jdk.jfr.Timespan
- jdk.jfr.Timestamp
- jdk.jfr.Frequency
- jdk.jfr.Flag
- jdk.jfr.MemoryAddress
- jdk.jfr.DataAmount
- jdk.jfr.NetworkAddress
 可以使用 ContentType类创建用户定义的内容类型。- 结果
- 
               内容类型,或 
              null如果不存在
- 另请参见:
-  
              ContentType
 
 -  getTypeNamepublic String getTypeName() 返回与此值描述符关联的类型的完全限定类名。- 结果
- 
               类型名称,而不是 
              null
- 另请参见:
-  
              getTypeId()
 
 -  getTypeIdpublic long getTypeId() 返回Java虚拟机(JVM)中类型的唯一ID。 JVM实例之间的ID可能不同。- 结果
- 类型ID,不是负面的
 
 -  isArraypublic boolean isArray() 返回此值描述符是否为数组类型。- 结果
-  
              true如果是数组类型,false
 
 -  getAnnotationpublic <A extends Annotation> A getAnnotation(类<A> annotationType) 如果为此值描述符直接存在具有相同名称的注释元素,则返回指定类型的第一个注释,否则null。- 参数类型
-  
              A- 要查询的注释的类型,如果存在则返回
- 参数
-  
              annotationType- 与注释类型对应的Class对象,而不是null
- 结果
- 
               如果直接存在,则此元素的指定注释类型的注释,否则为 
              null
 
 -  getAnnotationElementspublic List<AnnotationElement> getAnnotationElements() 返回此值描述符的注释元素的不可变列表。- 结果
- 
               注释列表,而不是 
              null
 
 -  getFieldspublic List<ValueDescriptor> getFields() 如果类型是复杂的,则返回值描述符的不可变列表,否则返回空列表。- 结果
- 
               值描述符列表,而不是 
              null
 
 
-  
 
-