Class ValueDescriptor
public final class ValueDescriptor extends Object
- Since:
 - 9
 
Constructor Summary
| Constructor | Description | 
|---|---|
ValueDescriptor | 
   Constructs a value descriptor, useful for dynamically creating event types and annotations.   | 
ValueDescriptor | 
   Constructs a value descriptor, useful for dynamically creating event types and annotations.   | 
Method Summary
| Modifier and Type | Method | Description | 
|---|---|---|
<A extends Annotation> | 
getAnnotation | 
  Returns the first annotation for the specified type if an annotation element with the same name is directly present for this value descriptor,   null otherwise. | 
List<AnnotationElement> | 
getAnnotationElements() | 
  Returns an immutable list of annotation elements for this value descriptor.   | 
String | 
getContentType() | 
  Returns a textual identifier that specifies how a value represented by this   ValueDescriptor is interpreted or formatted. | 
String | 
getDescription() | 
  Returns a sentence describing the value (for example,   "Maximum
 throughput in the transaction system. Value is reset after each new
 batch."). | 
List<ValueDescriptor> | 
getFields() | 
  Returns an immutable list of value descriptors if the type is complex, else an empty list.   | 
String | 
getLabel() | 
  Returns a human-readable name that describes the value (for example,   "Maximum Throughput"). | 
String | 
getName() | 
  Returns the name of the value (for example,   "maxThroughput"). | 
long | 
getTypeId() | 
  Returns a unique ID for the type in the Java virtual Machine (JVM).   | 
String | 
getTypeName() | 
  Returns the fully qualified class name of the type that is associated with this value descriptor.   | 
boolean | 
isArray() | 
  Returns if this value descriptor is an array type.   | 
Constructor Details
ValueDescriptor
public ValueDescriptor(Class<?> type, String name)
Constructs a value descriptor, useful for dynamically creating event types and annotations.
The following types are supported:
- 
byte.class - 
short.class - 
int.class - 
long.class - 
char.class - 
float.class - 
double.class - 
boolean.class - 
String.class - 
Class.class - 
Thread.class 
 The name must be a valid Java identifier (for example, "maxThroughput"). See 3.8 Java Language Specification for more information.
- Parameters:
 - 
type- the type, notnull - 
name- the name, notnull - Throws:
 - 
SecurityException- if a security manager is present and the caller doesn't haveFlightRecorderPermission("registerEvent") 
ValueDescriptor
public ValueDescriptor(Class<?> type, String name, List<AnnotationElement> annotations)
Constructs a value descriptor, useful for dynamically creating event types and annotations.
The following types are supported:
- 
byte.class - 
short.class - 
int.class - 
long.class - 
char.class - 
float.class - 
double.class - 
boolean.class - 
String.class - 
Class.class - 
Thread.class 
 The name must be a valid Java identifier (for example, "maxThroughput"). See 3.8 Java Language Specification for more information.
- Parameters:
 - 
type- the type, notnull - 
name- the name, notnull - 
annotations- the annotations on the value descriptors, notnull - Throws:
 - 
SecurityException- if a security manager is present and the caller doesn't haveFlightRecorderPermission("registerEvent") 
Method Details
getLabel
public String getLabel()
"Maximum Throughput").- Returns:
 - a human-readable name, or 
nullif doesn't exist 
getName
public String getName()
"maxThroughput").- Returns:
 - the name, not 
null 
getDescription
public String getDescription()
"Maximum
 throughput in the transaction system. Value is reset after each new
 batch.").- Returns:
 - the description, or 
nullif doesn't exist 
getContentType
public String getContentType()
ValueDescriptor is interpreted or formatted.  For example, if the value descriptor's type is float and the event value is 0.5f, a content type of "jdk.jfr.Percentage" hints to a client that the value is a percentage and that it should be rendered as "50%". 
The JDK provides the following predefined content types:
- jdk.jfr.Percentage
 - jdk.jfr.Timespan
 - jdk.jfr.Timestamp
 - jdk.jfr.Frequency
 - jdk.jfr.Flag
 - jdk.jfr.MemoryAddress
 - jdk.jfr.DataAmount
 - jdk.jfr.NetworkAddress
 
 User-defined content types can be created by using the ContentType class.
- Returns:
 - the content type, or 
nullif doesn't exist - See Also:
 
getTypeName
public String getTypeName()
- Returns:
 - the type name, not 
null - See Also:
 
getTypeId
public long getTypeId()
- Returns:
 - the type ID, not negative
 
isArray
public boolean isArray()
- Returns:
 - 
trueif it is an array type,falseotherwise 
getAnnotation
public <A extends Annotation> A getAnnotation(Class<A> annotationType)
null otherwise.- Type Parameters:
 - 
A- the type of the annotation to query for and return if present - Parameters:
 - 
annotationType- the Class object that corresponds to the annotation type, notnull - Returns:
 - this element's annotation for the specified annotation type if directly present, else 
null 
getAnnotationElements
public List<AnnotationElement> getAnnotationElements()
- Returns:
 - a list of annotations, not 
null 
getFields
public List<ValueDescriptor> getFields()
- Returns:
 - a list of value descriptors, not 
null 
    © 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
    https://docs.oracle.com/en/java/javase/17/docs/api/jdk.jfr/jdk/jfr/ValueDescriptor.html