The following example shows how AnnotationElement can be used to dynamically define events.
List<AnnotationElement> typeAnnotations = new ArrayList<>(); typeAnnotations.add(new AnnotationElement(Name.class, "com.example.HelloWorld")); typeAnnotations.add(new AnnotationElement(Label.class, "Hello World")); typeAnnotations.add(new AnnotationElement(Description.class, "Helps programmer getting started")); List<AnnotationElement> fieldAnnotations = new ArrayList<>(); fieldAnnotations.add(new AnnotationElement(Label.class, "Message")); List<ValueDescriptor> fields = new ArrayList<>(); fields.add(new ValueDescriptor(String.class, "message", fieldAnnotations)); EventFactory f = EventFactory.create(typeAnnotations, fields); Event event = f.newEvent(); event.commit();
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final boolean | |
| private final Type |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| public | AnnotationElement(Class<? extends Annotation>
interface extending
annotationType, Map<String, Object> java.lang.annotation.Annotation, not nulla values)Map with keys that match method names of the specified
annotation interfaceCreates an annotation element to use for dynamically defined events. |
| public | AnnotationElement(Class<? extends Annotation>
interface extending
annotationType, Object java.lang.annotation.Annotation, not nullthe value that matches the value)value method of the specified
annotationTypeCreates an annotation element to use for dynamically defined events. |
| public | AnnotationElement(Class<? extends Annotation>
interface extending java.lang.annotation.Annotation,
not annotationType)nullCreates an annotation element to use for dynamically defined events. |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public final < the type of the annotation to query for and return if it exists A> A | Returns: this element's annotation for the specified annotation type if it exists, elsenullthe annotationType)Class object corresponding to the annotation type,
not nullReturns the first annotation for the specified type if an
|
| public List | Returns: a list of meta annotation, notnullReturns an immutable list of annotation elements for this
|
| pack-priv Type | |
| public long | |
| public String | Returns: type name, notnullReturns the fully qualified name of the annotation type that corresponds to
this |
| public Object | |
| public List | Returns: the list of value descriptors for thisAnnotation, not
nullReturns an immutable list of descriptors that describes the annotation values
for this |
| public List | Returns: list of values, notnullReturns an immutable list of annotation values in an order that matches the
value descriptors for this |
| public boolean | |
| pack-priv boolean | |
| private static boolean |
| annotationValues | back to summary |
|---|---|
| private final List<Object> annotationValues | |
| inBootClassLoader | back to summary |
|---|---|
| private final boolean inBootClassLoader | |
| type | back to summary |
|---|---|
| private final Type type | |
| AnnotationElement | back to summary |
|---|---|
| pack-priv AnnotationElement(Type type, List<Object> objects, boolean boot) | |
| AnnotationElement | back to summary |
|---|---|
| public AnnotationElement(Class<? extends Annotation> annotationType, Map<String, Object> values) Creates an annotation element to use for dynamically defined events.
Supported value types are
If
To statically define events, see
| |
| AnnotationElement | back to summary |
|---|---|
| public AnnotationElement(Class<? extends Annotation> annotationType, Object value) Creates an annotation element to use for dynamically defined events.
Supported value types are
If
To statically define events, see
| |
| AnnotationElement | back to summary |
|---|---|
| public AnnotationElement(Class<? extends Annotation> annotationType) Creates an annotation element to use for dynamically defined events.
Supported value types are
If
To statically define events, see
| |
| checkType | back to summary |
|---|---|
| private static void checkType(Class<?> type) | |
| getAnnotation | back to summary |
|---|---|
| public final <A> A getAnnotation(Class<? extends Annotation> annotationType) Returns the first annotation for the specified type if an
| |
| getAnnotationElements | back to summary |
|---|---|
| public List Returns an immutable list of annotation elements for this
| |
| getType | back to summary |
|---|---|
| pack-priv Type getType() | |
| getTypeId | back to summary |
|---|---|
| public long getTypeId() Returns the type ID for this The ID is a unique identifier for the type in the Java Virtual Machine (JVM). The ID might not be the same between JVM instances.
| |
| getTypeName | back to summary |
|---|---|
| public String getTypeName() Returns the fully qualified name of the annotation type that corresponds to
this
| |
| getValue | back to summary |
|---|---|
| public Object getValue(String name) Returns a value for this
| |
| getValueDescriptors | back to summary |
|---|---|
| public List Returns an immutable list of descriptors that describes the annotation values
for this
| |
| getValues | back to summary |
|---|---|
| public List Returns an immutable list of annotation values in an order that matches the
value descriptors for this | |
| hasValue | back to summary |
|---|---|
| public boolean hasValue(String name) Returns
| |
| isInBoot | back to summary |
|---|---|
| pack-priv boolean isInBoot() | |
| isKnownJFRAnnotation | back to summary |
|---|---|
| private static boolean isKnownJFRAnnotation(Class<? extends Annotation> annotationType) | |