Java Code Examples for jdk.jfr.internal.Type#getName()
The following examples show how to use
jdk.jfr.internal.Type#getName() .
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: ParserFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private Parser createPrimitiveParser(Type type) throws IOException { switch (type.getName()) { case "int": return new IntegerParser(); case "long": return new LongParser(); case "float": return new FloatParser(); case "double": return new DoubleParser(); case "char": return new CharacterParser(); case "boolean": return new BooleanParser(); case "short": return new ShortParser(); case "byte": return new ByteParser(); case "java.lang.String": ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type.getName()); constantPools.put(type.getId(), pool); return new StringParser(pool); default: throw new IOException("Unknown primitive type " + type.getName()); } }
Example 2
Source File: ObjectFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public static ObjectFactory<?> create(Type type, TimeConverter timeConverter) { switch (type.getName()) { case "java.lang.Thread": return RecordedThread.createFactory(type, timeConverter); case Type.ORACLE_TYPE_PREFIX + "StackFrame": return RecordedFrame.createFactory(type, timeConverter); case Type.ORACLE_TYPE_PREFIX + "Method": return RecordedMethod.createFactory(type, timeConverter); case Type.ORACLE_TYPE_PREFIX + "ThreadGroup": return RecordedThreadGroup.createFactory(type, timeConverter); case Type.ORACLE_TYPE_PREFIX + "StackTrace": return RecordedStackTrace.createFactory(type, timeConverter); case Type.ORACLE_TYPE_PREFIX + "ClassLoader": return RecordedClassLoader.createFactory(type, timeConverter); case "java.lang.Class": return RecordedClass.createFactory(type, timeConverter); } return null; }
Example 3
Source File: PrettyWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void printType(Type t) throws IOException { print("// id: "); println(String.valueOf(t.getId())); int commentIndex = t.getName().length() + 10; String typeName = t.getName(); int index = typeName.lastIndexOf("."); if (index != -1) { println("package " + typeName.substring(0, index) + ";"); } printAnnotations(commentIndex, t.getAnnotationElements()); print("class " + typeName.substring(index + 1)); String superType = t.getSuperType(); if (superType != null) { print(" extends " + superType); } println(" {"); indent(); for (ValueDescriptor v : t.getFields()) { printField(commentIndex, v); } retract(); println("}"); println(); }
Example 4
Source File: ObjectFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static ObjectFactory<?> create(Type type, TimeConverter timeConverter) { switch (type.getName()) { case "java.lang.Thread": return RecordedThread.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "StackFrame": case TYPE_PREFIX_VERSION_2 + "StackFrame": return RecordedFrame.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "Method": case TYPE_PREFIX_VERSION_2 + "Method": return RecordedMethod.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "ThreadGroup": case TYPE_PREFIX_VERSION_2 + "ThreadGroup": return RecordedThreadGroup.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "StackTrace": case TYPE_PREFIX_VERSION_2 + "StackTrace": return RecordedStackTrace.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "ClassLoader": case TYPE_PREFIX_VERSION_2 + "ClassLoader": return RecordedClassLoader.createFactory(type, timeConverter); case "java.lang.Class": return RecordedClass.createFactory(type, timeConverter); } return null; }
Example 5
Source File: ParserFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private Parser createPrimitiveParser(Type type) throws IOException { switch (type.getName()) { case "int": return new IntegerParser(); case "long": return new LongParser(); case "float": return new FloatParser(); case "double": return new DoubleParser(); case "char": return new CharacterParser(); case "boolean": return new BooleanParser(); case "short": return new ShortParser(); case "byte": return new ByteParser(); case "java.lang.String": ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type.getName()); constantPools.put(type.getId(), pool); return new StringParser(pool); default: throw new IOException("Unknown primitive type " + type.getName()); } }
Example 6
Source File: ParserFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private Parser createPrimitiveParser(Type type) throws IOException { switch (type.getName()) { case "int": return new IntegerParser(); case "long": return new LongParser(); case "float": return new FloatParser(); case "double": return new DoubleParser(); case "char": return new CharacterParser(); case "boolean": return new BooleanParser(); case "short": return new ShortParser(); case "byte": return new ByteParser(); case "java.lang.String": ConstantMap pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type.getName()); constantPools.put(type.getId(), pool); return new StringParser(pool); default: throw new IOException("Unknown primitive type " + type.getName()); } }
Example 7
Source File: ObjectFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static ObjectFactory<?> create(Type type, TimeConverter timeConverter) { switch (type.getName()) { case "java.lang.Thread": return RecordedThread.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "StackFrame": case TYPE_PREFIX_VERSION_2 + "StackFrame": return RecordedFrame.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "Method": case TYPE_PREFIX_VERSION_2 + "Method": return RecordedMethod.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "ThreadGroup": case TYPE_PREFIX_VERSION_2 + "ThreadGroup": return RecordedThreadGroup.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "StackTrace": case TYPE_PREFIX_VERSION_2 + "StackTrace": return RecordedStackTrace.createFactory(type, timeConverter); case TYPE_PREFIX_VERSION_1 + "ClassLoader": case TYPE_PREFIX_VERSION_2 + "ClassLoader": return RecordedClassLoader.createFactory(type, timeConverter); case "java.lang.Class": return RecordedClass.createFactory(type, timeConverter); } return null; }
Example 8
Source File: PrettyWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void printType(Type t) { if (showIds) { print("// id: "); println(String.valueOf(t.getId())); } int commentIndex = t.getName().length() + 10; String typeName = t.getName(); int index = typeName.lastIndexOf("."); if (index != -1) { println("@Name(\"" + typeName + "\")"); } printAnnotations(commentIndex, t.getAnnotationElements()); print("class " + typeName.substring(index + 1)); String superType = t.getSuperType(); if (superType != null) { print(" extends " + superType); } println(" {"); indent(); boolean first = true; for (ValueDescriptor v : t.getFields()) { printField(commentIndex, v, first); first = false; } retract(); println("}"); println(); }
Example 9
Source File: Metadata.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public int compare(Type t1, Type t2) { int g1 = groupValue(t1); int g2 = groupValue(t2); if (g1 == g2) { String n1 = t1.getName(); String n2 = t2.getName(); String package1 = n1.substring(0, n1.lastIndexOf('.') + 1); String package2 = n2.substring(0, n2.lastIndexOf('.') + 1); if (package1.equals(package2)) { return n1.compareTo(n2); } else { // Ensure that jdk.* are printed first // This makes it easier to find user defined events at the end. if (Type.SUPER_TYPE_EVENT.equals(t1.getSuperType()) && !package1.equals(package2)) { if (package1.equals("jdk.jfr")) { return -1; } if (package2.equals("jdk.jfr")) { return 1; } } return package1.compareTo(package2); } } else { return Integer.compare(groupValue(t1), groupValue(t2)); } }
Example 10
Source File: ParserFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private Parser createParser(ValueDescriptor v) throws IOException { boolean constantPool = PrivateAccess.getInstance().isConstantPool(v); if (v.isArray()) { Type valueType = PrivateAccess.getInstance().getType(v); ValueDescriptor element = PrivateAccess.getInstance().newValueDescriptor(v.getName(), valueType, v.getAnnotationElements(), 0, constantPool, null); return new ArrayParser(createParser(element)); } long id = v.getTypeId(); Type type = types.get(id); if (type == null) { throw new IOException("Type '" + v.getTypeName() + "' is not defined"); } if (constantPool) { ConstantMap pool = constantPools.get(id); if (pool == null) { pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type.getName()); constantPools.put(id, pool); } return new ConstantMapValueParser(pool); } Parser parser = parsers.get(id); if (parser == null) { if (!v.getFields().isEmpty()) { return createCompositeParser(type); } else { return registerParserType(type, createPrimitiveParser(type)); } } return parser; }
Example 11
Source File: PrettyWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void printType(Type t) { if (showIds) { print("// id: "); println(String.valueOf(t.getId())); } int commentIndex = t.getName().length() + 10; String typeName = t.getName(); int index = typeName.lastIndexOf("."); if (index != -1) { println("@Name(\"" + typeName + "\")"); } printAnnotations(commentIndex, t.getAnnotationElements()); print("class " + typeName.substring(index + 1)); String superType = t.getSuperType(); if (superType != null) { print(" extends " + superType); } println(" {"); indent(); boolean first = true; for (ValueDescriptor v : t.getFields()) { printField(commentIndex, v, first); first = false; } retract(); println("}"); println(); }
Example 12
Source File: Metadata.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public int compare(Type t1, Type t2) { int g1 = groupValue(t1); int g2 = groupValue(t2); if (g1 == g2) { String n1 = t1.getName(); String n2 = t2.getName(); String package1 = n1.substring(0, n1.lastIndexOf('.') + 1); String package2 = n2.substring(0, n2.lastIndexOf('.') + 1); if (package1.equals(package2)) { return n1.compareTo(n2); } else { // Ensure that jdk.* are printed first // This makes it easier to find user defined events at the end. if (Type.SUPER_TYPE_EVENT.equals(t1.getSuperType()) && !package1.equals(package2)) { if (package1.equals("jdk.jfr")) { return -1; } if (package2.equals("jdk.jfr")) { return 1; } } return package1.compareTo(package2); } } else { return Integer.compare(groupValue(t1), groupValue(t2)); } }
Example 13
Source File: ParserFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private Parser createParser(ValueDescriptor v) throws IOException { boolean constantPool = PrivateAccess.getInstance().isConstantPool(v); if (v.isArray()) { Type valueType = PrivateAccess.getInstance().getType(v); ValueDescriptor element = PrivateAccess.getInstance().newValueDescriptor(v.getName(), valueType, v.getAnnotationElements(), 0, constantPool, null); return new ArrayParser(createParser(element)); } long id = v.getTypeId(); Type type = types.get(id); if (type == null) { throw new IOException("Type '" + v.getTypeName() + "' is not defined"); } if (constantPool) { ConstantMap pool = constantPools.get(id); if (pool == null) { pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type.getName()); constantPools.put(id, pool); } return new ConstantMapValueParser(pool); } Parser parser = parsers.get(id); if (parser == null) { if (!v.getFields().isEmpty()) { return createCompositeParser(type); } else { return registerParserType(type, createPrimitiveParser(type)); } } return parser; }
Example 14
Source File: ParserFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private Parser createParser(ValueDescriptor v) throws IOException { boolean constantPool = PrivateAccess.getInstance().isConstantPool(v); if (v.isArray()) { Type valueType = PrivateAccess.getInstance().getType(v); ValueDescriptor element = PrivateAccess.getInstance().newValueDescriptor(v.getName(), valueType, v.getAnnotationElements(), 0, constantPool, null); return new ArrayParser(createParser(element)); } long id = v.getTypeId(); Type type = types.get(id); if (type == null) { throw new IOException("Type '" + v.getTypeName() + "' is not defined"); } if (constantPool) { ConstantMap pool = constantPools.get(id); if (pool == null) { pool = new ConstantMap(ObjectFactory.create(type, timeConverter), type.getName()); constantPools.put(id, pool); } return new ConstantMapValueParser(pool); } Parser parser = parsers.get(id); if (parser == null) { if (!v.getFields().isEmpty()) { return createCompositeParser(type); } else { return registerParserType(type, createPrimitiveParser(type)); } } return parser; }
Example 15
Source File: ChunkParser.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private String getName(long id) { Type type = typeMap.get(id); return type == null ? ("unknown(" + id + ")") : type.getName(); }
Example 16
Source File: ChunkParser.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private String getName(long id) { Type type = typeMap.get(id); return type == null ? ("unknown(" + id + ")") : type.getName(); }
Example 17
Source File: ChunkParser.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
private String getName(long id) { Type type = typeMap.get(id); return type == null ? ("unknown(" + id +")") : type.getName(); }