@Target({TYPE,FIELD,METHOD}) @Retention(RUNTIME) public @interface Name
For event classes, the name must be a legal class name as specified in the Java language, (for example, "com.example.Transaction"
. For event fields or event settings, the name must be a valid identifier (for example, "message"
). See section 3.8 and 3.9 of the Java Language Specification for more information.
If the specified name is invalid, the annotation is ignored.
A stable and easy-to-use event name is of the form:
[org|com|net].[organization|product].EventName
Events without a @Name
annotation get their name from the fully qualified class name, which works well for experimentation but should be avoided in production.
"jfr"
, "internal"
, "events"
, or "Event"
."jdk"
namespace, with no sub-namespaces for "hotspot"
, "gc"
, or "compiler"
. This avoids unnecessary cognitive load for users. Events can instead be arranged into categories, by using the @Category
annotation. Categories can be renamed freely without causing disruption to dependenciesModifier and Type | Required Element | Description |
---|---|---|
String |
value |
Returns the name. |
String value
© 1993, 2023, 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/21/docs/api/jdk.jfr/jdk/jfr/Name.html