Java Code Examples for jdk.jfr.Name#value()
The following examples show how to use
jdk.jfr.Name#value() .
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: TypeLibrary.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static Type defineType(Class<?> clazz, String superType, boolean eventType) { if (!isDefined(clazz)) { Name name = clazz.getAnnotation(Name.class); String typeName = name != null ? name.value() : clazz.getName(); long id = Type.getTypeId(clazz); Type t; if (eventType) { t = new PlatformEventType(typeName, id, clazz.getClassLoader() == null, true); } else { t = new Type(typeName, superType, id); } types.put(t.getId(), t); return t; } return null; }
Example 2
Source File: TypeLibrary.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static Type defineType(Class<?> clazz, String superType, boolean eventType) { if (!isDefined(clazz)) { Name name = clazz.getAnnotation(Name.class); String typeName = name != null ? name.value() : clazz.getName(); long id = Type.getTypeId(clazz); Type t; if (eventType) { t = new PlatformEventType(typeName, id, clazz.getClassLoader() == null, true); } else { t = new Type(typeName, superType, id); } types.put(t.getId(), t); return t; } return null; }
Example 3
Source File: TypeLibrary.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static Type defineType(Class<?> clazz, String superType, boolean eventType) { if (!isDefined(clazz)) { Name name = clazz.getAnnotation(Name.class); String typeName = name != null ? name.value() : clazz.getName(); long id = Type.getTypeId(clazz); Type t; if (eventType) { t = new PlatformEventType(typeName, id, clazz.getClassLoader() == null, true); } else { t = new Type(typeName, superType, id); } types.put(t.getId(), t); return t; } return null; }
Example 4
Source File: TypeLibrary.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static ValueDescriptor createField(Field field) { int mod = field.getModifiers(); if (Modifier.isTransient(mod)) { return null; } if (Modifier.isStatic(mod)) { return null; } Class<?> fieldType = field.getType(); if (!Type.isKnownType(fieldType)) { return null; } boolean constantPool = Thread.class == fieldType || fieldType == Class.class; Type type = createType(fieldType); String fieldName = field.getName(); Name name = field.getAnnotation(Name.class); String useName = fieldName; if (name != null) { useName = name.value(); } List<jdk.jfr.AnnotationElement> ans = new ArrayList<>(); for (Annotation a : resolveRepeatedAnnotations(field.getAnnotations())) { AnnotationElement ae = createAnnotation(a); if (ae != null) { ans.add(ae); } } return PrivateAccess.getInstance().newValueDescriptor(useName, type, ans, 0, constantPool, fieldName); }
Example 5
Source File: EventControl.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private void defineSettings(Class<?> eventClass) { // Iterate up the class hierarchy and let // subclasses shadow base classes. boolean allowPrivateMethod = true; while (eventClass != null) { for (Method m : eventClass.getDeclaredMethods()) { boolean isPrivate = Modifier.isPrivate(m.getModifiers()); if (m.getReturnType() == Boolean.TYPE && m.getParameterCount() == 1 && (!isPrivate || allowPrivateMethod)) { SettingDefinition se = m.getDeclaredAnnotation(SettingDefinition.class); if (se != null) { Class<?> settingClass = m.getParameters()[0].getType(); if (!Modifier.isAbstract(settingClass.getModifiers()) && SettingControl.class.isAssignableFrom(settingClass)) { String name = m.getName(); Name n = m.getAnnotation(Name.class); if (n != null) { name = n.value(); } if (!eventControls.containsKey(name)) { defineSetting((Class<? extends SettingControl>) settingClass, m, type, name); } } } } } eventClass = eventClass.getSuperclass(); allowPrivateMethod = false; } }
Example 6
Source File: TypeLibrary.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static ValueDescriptor createField(Field field) { int mod = field.getModifiers(); if (Modifier.isTransient(mod)) { return null; } if (Modifier.isStatic(mod)) { return null; } Class<?> fieldType = field.getType(); if (!Type.isKnownType(fieldType)) { return null; } boolean constantPool = Thread.class == fieldType || fieldType == Class.class; Type type = createType(fieldType); String fieldName = field.getName(); Name name = field.getAnnotation(Name.class); String useName = fieldName; if (name != null) { useName = name.value(); } List<jdk.jfr.AnnotationElement> ans = new ArrayList<>(); for (Annotation a : resolveRepeatedAnnotations(field.getAnnotations())) { AnnotationElement ae = createAnnotation(a); if (ae != null) { ans.add(ae); } } return PrivateAccess.getInstance().newValueDescriptor(useName, type, ans, 0, constantPool, fieldName); }
Example 7
Source File: EventControl.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private void defineSettings(Class<?> eventClass) { // Iterate up the class hierarchy and let // subclasses shadow base classes. boolean allowPrivateMethod = true; while (eventClass != null) { for (Method m : eventClass.getDeclaredMethods()) { boolean isPrivate = Modifier.isPrivate(m.getModifiers()); if (m.getReturnType() == Boolean.TYPE && m.getParameterCount() == 1 && (!isPrivate || allowPrivateMethod)) { SettingDefinition se = m.getDeclaredAnnotation(SettingDefinition.class); if (se != null) { Class<?> settingClass = m.getParameters()[0].getType(); if (!Modifier.isAbstract(settingClass.getModifiers()) && SettingControl.class.isAssignableFrom(settingClass)) { String name = m.getName(); Name n = m.getAnnotation(Name.class); if (n != null) { name = n.value(); } if (!eventControls.containsKey(name)) { defineSetting((Class<? extends SettingControl>) settingClass, m, type, name); } } } } } eventClass = eventClass.getSuperclass(); allowPrivateMethod = false; } }
Example 8
Source File: TypeLibrary.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static ValueDescriptor createField(Field field) { int mod = field.getModifiers(); if (Modifier.isTransient(mod)) { return null; } if (Modifier.isStatic(mod)) { return null; } Class<?> fieldType = field.getType(); if (!Type.isKnownType(fieldType)) { return null; } boolean constantPool = Thread.class == fieldType || fieldType == Class.class; Type type = createType(fieldType); String fieldName = field.getName(); Name name = field.getAnnotation(Name.class); String useName = fieldName; if (name != null) { useName = name.value(); } List<jdk.jfr.AnnotationElement> ans = new ArrayList<>(); for (Annotation a : resolveRepeatedAnnotations(field.getAnnotations())) { AnnotationElement ae = createAnnotation(a); if (ae != null) { ans.add(ae); } } return PrivateAccess.getInstance().newValueDescriptor(useName, type, ans, 0, constantPool, fieldName); }
Example 9
Source File: EventControl.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") private void defineSettings(Class<?> eventClass) { // Iterate up the class hierarchy and let // subclasses shadow base classes. boolean allowPrivateMethod = true; while (eventClass != null) { for (Method m : eventClass.getDeclaredMethods()) { boolean isPrivate = Modifier.isPrivate(m.getModifiers()); if (m.getReturnType() == Boolean.TYPE && m.getParameterCount() == 1 && (!isPrivate || allowPrivateMethod)) { SettingDefinition se = m.getDeclaredAnnotation(SettingDefinition.class); if (se != null) { Class<?> settingClass = m.getParameters()[0].getType(); if (!Modifier.isAbstract(settingClass.getModifiers()) && SettingControl.class.isAssignableFrom(settingClass)) { String name = m.getName(); Name n = m.getAnnotation(Name.class); if (n != null) { name = n.value(); } if (!eventControls.containsKey(name)) { defineSetting((Class<? extends SettingControl>) settingClass, m, type, name); } } } } } eventClass = eventClass.getSuperclass(); allowPrivateMethod = false; } }