SettingDescriptor (Java SE 26 & JDK 26)
Description: declaration: module: jdk.jfr, package: jdk.jfr, class: SettingDescriptor
Keywords: jdk.jfr.SettingDescriptor class

# Class SettingDescriptor

java.lang.Object
jdk.jfr.SettingDescriptor

public final class SettingDescriptor extends Object
Describes an event setting.

Since:
  9

- ## Method Summary

  Modifier and Type
  Method
  Description
  `<A extends Annotation>
  A`
  `getAnnotation(Class<A> annotationType)`
  Returns the first annotation for the specified type if an annotation element with the same name is available, `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 that is represented by this `SettingDescriptor` object is interpreted or formatted.
  `String`
  `getDefaultValue()`
  Returns the default value for this setting descriptor.
  `String`
  `getDescription()`
  Returns a sentence that describes the setting (for example `"Record event with duration above or equal to threshold"`).
  `String`
  `getLabel()`
  Returns a human-readable name that describes the setting (for example, `"Threshold"`).
  `String`
  `getName()`
  Returns the name of the setting (for example, `"threshold"`).
  `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 setting descriptor.

  ### Methods declared in class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
  Modifier and Type
  Method
  Description
  `protected Object`
  `clone()`
  Creates and returns a copy of this object.
  `boolean`
  `equals(Object obj)`
  Indicates whether some other object is "equal to" this one.
  `protected void`
  `finalize()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  Finalization is deprecated and subject to removal in a future release.
  `final Class<?>`
  `getClass()`
  Returns the runtime class of this `Object`.
  `int`
  `hashCode()`
  Returns a hash code value for this object.
  `final void`
  `notify()`
  Wakes up a single thread that is waiting on this object's monitor.
  `final void`
  `notifyAll()`
  Wakes up all threads that are waiting on this object's monitor.
  `String`
  `toString()`
  Returns a string representation of the object.
  `final void`
  `wait()`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted.
  `final void`
  `wait(long timeoutMillis)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
  `final void`
  `wait(long timeoutMillis, int nanos)`
  Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

- ## Method Details

  - ### getName

    public String getName()
    Returns the name of the setting (for example, `"threshold"`).
    Returns:
      the name, not `null`

  - ### getLabel

    public String getLabel()
    Returns a human-readable name that describes the setting (for example, `"Threshold"`).

    If the setting lacks a label, the label for the type that is associated with this setting is returned, or `null` if doesn't exist

    Returns:
      a human-readable name, or `null` if doesn't exist

  - ### getDescription

    public String getDescription()
    Returns a sentence that describes the setting (for example `"Record event with duration above or equal to threshold"`).

    If the setting lacks a description, the description for the type that is associated with this setting is returned, or `null` if doesn't exist.

    Returns:
      the description, or `null` if doesn't exist

  - ### getContentType

    public String getContentType()
    Returns a textual identifier that specifies how a value that is represented by this `SettingDescriptor` object is interpreted or formatted.

    For example, if the setting descriptor represents a percentage, then `"jdk.jfr.Percentage"` hints to a client that a value of "0.5" is formatted 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 `ContentType`.

    If the setting lacks a content type, the content type for the type that is associated with this setting is returned, or `null` if not available.

    Returns:
      the content type, or `null` if doesn't exist
    See Also:
      - `ContentType`

  - ### getTypeName

    public String getTypeName()
    Returns the fully qualified class name of the type that is associated with this setting descriptor.
    Returns:
      the type name, not `null`
    See Also:
      - `getTypeId()`

  - ### getTypeId

    public long getTypeId()
    Returns a unique ID for the type in the Java Virtual Machine (JVM).

    The ID might not be the same between JVM instances.

    Returns:
      the type ID, not negative

  - ### getAnnotation

    public <A extends Annotation> A getAnnotation(Class<A> annotationType)
    Returns the first annotation for the specified type if an annotation element with the same name is available, `null` otherwise.
    Type Parameters:
      `A` - the type of the annotation to query for and return if available
    Parameters:
      `annotationType` - the Class object that corresponds to the annotation type, not `null`
    Returns:
      this element's annotation for the specified annotation type if available, `null` otherwise

  - ### getAnnotationElements

    public List<AnnotationElement> getAnnotationElements()
    Returns an immutable list of annotation elements for this value descriptor.
    Returns:
      a list of annotations, not `null`

  - ### getDefaultValue

    public String getDefaultValue()
    Returns the default value for this setting descriptor.
    Returns:
      the default value, not `null`