Java Code Examples for jdk.jfr.EventType#getAnnotationElements()

The following examples show how to use jdk.jfr.EventType#getAnnotationElements() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestGetAnnotations.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    EventType type = EventType.getEventType(MyEvent.class);
    List<AnnotationElement> annos = type.getAnnotationElements();
    Asserts.assertEquals(annos.size(), 2, "Wrong number of annotations");
    assertAnnotation(annos, "jdk.jfr.Label", MY_LABEL);
    assertAnnotation(annos, "jdk.jfr.Description", MY_DESCRIPTION);
}
 
Example 2
Source File: Events.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static AnnotationElement getAnnotationByName(EventType t, String name) throws Exception {
    for (AnnotationElement a : t.getAnnotationElements()) {
        if (a.getTypeName().equals(name)) {
            return a;
        }
    }
    throw new Exception("Could not find annotation '" + name + " in type " + t.getName());
}
 
Example 3
Source File: TestGetAnnotations.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    EventType type = EventType.getEventType(MyEvent.class);
    List<AnnotationElement> annos = type.getAnnotationElements();
    Asserts.assertEquals(annos.size(), 2, "Wrong number of annotations");
    assertAnnotation(annos, "jdk.jfr.Label", MY_LABEL);
    assertAnnotation(annos, "jdk.jfr.Description", MY_DESCRIPTION);
}
 
Example 4
Source File: Events.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static AnnotationElement getAnnotationByName(EventType t, String name) throws Exception {
    for (AnnotationElement a : t.getAnnotationElements()) {
        if (a.getTypeName().equals(name)) {
            return a;
        }
    }
    throw new Exception("Could not find annotation '" + name + " in type " + t.getName());
}
 
Example 5
Source File: TestGetAnnotations.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Throwable {
    EventType type = EventType.getEventType(MyEvent.class);
    List<AnnotationElement> annos = type.getAnnotationElements();
    Asserts.assertEquals(annos.size(), 2, "Wrong number of annotations");
    assertAnnotation(annos, "jdk.jfr.Label", MY_LABEL);
    assertAnnotation(annos, "jdk.jfr.Description", MY_DESCRIPTION);
}
 
Example 6
Source File: Events.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static AnnotationElement getAnnotationByName(EventType t, String name) throws Exception {
    for (AnnotationElement a : t.getAnnotationElements()) {
        if (a.getTypeName().equals(name)) {
            return a;
        }
    }
    throw new Exception("Could not find annotation '" + name + " in type " + t.getName());
}