Java源码示例:jdk.jfr.Relational
示例1
public static void main(String[] args) throws Exception {
EventType t = EventType.getEventType(UserEvent.class);
ValueDescriptor field = t.getField("id");
AnnotationElement userId = Events.getAnnotation(field, UserId.class);
Relational r = userId.getAnnotation(Relational.class);
Asserts.assertTrue(r != null, "Expected relational annotation to have annotation @Relational");
}
示例2
private Map<String, AnnotationElement> buildRelationMap(Map<String, Type> typeMap) {
Map<String, AnnotationElement> relationMap = new HashMap<>();
for (String relation : relations) {
Type relationType = new Type(Type.TYPES_PREFIX + relation, Type.SUPER_TYPE_ANNOTATION, eventTypeId++);
relationType.setAnnotations(Collections.singletonList(new AnnotationElement(Relational.class)));
AnnotationElement ae = PrivateAccess.getInstance().newAnnotation(relationType, Collections.emptyList(), true);
relationMap.put(relation, ae);
typeMap.put(relationType.getName(), relationType);
}
return relationMap;
}
示例3
public static void main(String[] args) throws Exception {
EventType t = EventType.getEventType(UserEvent.class);
ValueDescriptor field = t.getField("id");
AnnotationElement userId = Events.getAnnotation(field, UserId.class);
Relational r = userId.getAnnotation(Relational.class);
Asserts.assertTrue(r != null, "Expected relational annotation to have annotation @Relational");
}
示例4
private Map<String, AnnotationElement> buildRelationMap(Map<String, Type> typeMap) {
Map<String, AnnotationElement> relationMap = new HashMap<>();
for (String relation : relations) {
Type relationType = new Type(Type.TYPES_PREFIX + relation, Type.SUPER_TYPE_ANNOTATION, eventTypeId++);
relationType.setAnnotations(Collections.singletonList(new AnnotationElement(Relational.class)));
AnnotationElement ae = PrivateAccess.getInstance().newAnnotation(relationType, Collections.emptyList(), true);
relationMap.put(relation, ae);
typeMap.put(relationType.getName(), relationType);
}
return relationMap;
}
示例5
public static void main(String[] args) throws Exception {
EventType t = EventType.getEventType(UserEvent.class);
ValueDescriptor field = t.getField("id");
AnnotationElement userId = Events.getAnnotation(field, UserId.class);
Relational r = userId.getAnnotation(Relational.class);
Asserts.assertTrue(r != null, "Expected relational annotation to have annotation @Relational");
}