Annotation Interface Name
@Target({TYPE,FIELD,METHOD}) @Retention(RUNTIME) public @interface Name
The name must be a valid identifier as specified in the Java language (for example, "com.example.Transaction"
for an event class or "message"
for an event field).
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.
- The name should be stable to avoid breaking setting files and code that consumes or configures the event.
- The name should not contain redundant or unnecessary information such as
"jfr"
,"internal"
,"events"
, or"Event"
. - The name should be short, but not so short that it clashes with other organizations or products.
- The name should be easy to understand and remember for users that want to configure the event. This is especially true if the event is part of a framework or library that is meant to be used by others. It is usually enough to put all the events for a library or product in the same namespace. For example, all the events for OpenJDK are in the
"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 dependencies
- Since:
- 9
Required Element Summary
Modifier and Type | Required Element | Description |
---|---|---|
String |
value |
Returns the name. |
Element Details
value
String value
- Returns:
- the name
© 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/Name.html