Java Code Examples for jdk.jfr.internal.MetadataDescriptor.Element#addAttribute()
The following examples show how to use
jdk.jfr.internal.MetadataDescriptor.Element#addAttribute() .
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: MetadataReader.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private Element createElement() throws IOException { String name = readString(); Element e = new Element(name); int attributeCount = readInt(); for (int i = 0; i < attributeCount; i++) { e.addAttribute(readString(), readString()); } int childrenCount = readInt(); for (int i = 0; i < childrenCount; i++) { e.add(createElement()); } return e; }
Example 2
Source File: MetadataWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public MetadataWriter(MetadataDescriptor descriptor) { descriptor.getTypes().forEach(type -> makeTypeElement(metadata, type)); root.add(metadata); Element region = new Element("region"); region.addAttribute(ATTRIBUTE_LOCALE, descriptor.locale); region.addAttribute(ATTRIBUTE_GMT_OFFSET, descriptor.gmtOffset); root.add(region); }
Example 3
Source File: MetadataWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void makeSettingElement(Element typeElement, SettingDescriptor s) { Element element = typeElement.newChild(ELEMENT_SETTING); element.addAttribute(ATTRIBUTE_NAME, s.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, s.getTypeId()); element.addAttribute(ATTRIBUTE_DEFAULT_VALUE, s.getDefaultValue()); for (AnnotationElement a : s.getAnnotationElements()) { makeAnnotation(element, a); } }
Example 4
Source File: MetadataWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void makeFieldElement(Element typeElement, ValueDescriptor v) { Element element = typeElement.newChild(ELEMENT_FIELD); element.addAttribute(ATTRIBUTE_NAME, v.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, v.getTypeId()); if (v.isArray()) { element.addAttribute(ATTRIBUTE_DIMENSION, 1); } if (PrivateAccess.getInstance().isConstantPool(v)) { element.addAttribute(ATTRIBUTE_CONSTANT_POOL, true); } for (AnnotationElement a : v.getAnnotationElements()) { makeAnnotation(element, a); } }
Example 5
Source File: MetadataWriter.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private void makeAnnotation(Element entity, AnnotationElement annotation) { Element element = entity.newChild(ELEMENT_ANNOTATION); element.addAttribute(ATTRIBUTE_TYPE_ID, annotation.getTypeId()); List<Object> values = annotation.getValues(); int index = 0; for (ValueDescriptor v : annotation.getValueDescriptors()) { Object value = values.get(index++); if (v.isArray()) { element.addArrayAttribute(element, v.getName(), value); } else { element.addAttribute(v.getName(), value); } } }
Example 6
Source File: MetadataReader.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private Element createElement() throws IOException { String name = readString(); Element e = new Element(name); int attributeCount = readInt(); for (int i = 0; i < attributeCount; i++) { e.addAttribute(readString(), readString()); } int childrenCount = readInt(); for (int i = 0; i < childrenCount; i++) { e.add(createElement()); } return e; }
Example 7
Source File: MetadataWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public MetadataWriter(MetadataDescriptor descriptor) { descriptor.getTypes().forEach(type -> makeTypeElement(metadata, type)); root.add(metadata); Element region = new Element("region"); region.addAttribute(ATTRIBUTE_LOCALE, descriptor.locale); region.addAttribute(ATTRIBUTE_GMT_OFFSET, descriptor.gmtOffset); root.add(region); }
Example 8
Source File: MetadataWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void makeSettingElement(Element typeElement, SettingDescriptor s) { Element element = typeElement.newChild(ELEMENT_SETTING); element.addAttribute(ATTRIBUTE_NAME, s.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, s.getTypeId()); element.addAttribute(ATTRIBUTE_DEFAULT_VALUE, s.getDefaultValue()); for (AnnotationElement a : s.getAnnotationElements()) { makeAnnotation(element, a); } }
Example 9
Source File: MetadataWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void makeFieldElement(Element typeElement, ValueDescriptor v) { Element element = typeElement.newChild(ELEMENT_FIELD); element.addAttribute(ATTRIBUTE_NAME, v.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, v.getTypeId()); if (v.isArray()) { element.addAttribute(ATTRIBUTE_DIMENSION, 1); } if (PrivateAccess.getInstance().isConstantPool(v)) { element.addAttribute(ATTRIBUTE_CONSTANT_POOL, true); } for (AnnotationElement a : v.getAnnotationElements()) { makeAnnotation(element, a); } }
Example 10
Source File: MetadataWriter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private void makeAnnotation(Element entity, AnnotationElement annotation) { Element element = entity.newChild(ELEMENT_ANNOTATION); element.addAttribute(ATTRIBUTE_TYPE_ID, annotation.getTypeId()); List<Object> values = annotation.getValues(); int index = 0; for (ValueDescriptor v : annotation.getValueDescriptors()) { Object value = values.get(index++); if (v.isArray()) { element.addArrayAttribute(element, v.getName(), value); } else { element.addAttribute(v.getName(), value); } } }
Example 11
Source File: MetadataReader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private Element createElement() throws IOException { String name = readString(); Element e = new Element(name); int attributeCount = readInt(); for (int i = 0; i < attributeCount; i++) { e.addAttribute(readString(), readString()); } int childrenCount = readInt(); for (int i = 0; i < childrenCount; i++) { e.add(createElement()); } return e; }
Example 12
Source File: MetadataWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public MetadataWriter(MetadataDescriptor descriptor) { descriptor.getTypes().forEach(type -> makeTypeElement(metadata, type)); root.add(metadata); Element region = new Element("region"); region.addAttribute(ATTRIBUTE_LOCALE, descriptor.locale); region.addAttribute(ATTRIBUTE_GMT_OFFSET, descriptor.gmtOffset); root.add(region); }
Example 13
Source File: MetadataWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void makeSettingElement(Element typeElement, SettingDescriptor s) { Element element = typeElement.newChild(ELEMENT_SETTING); element.addAttribute(ATTRIBUTE_NAME, s.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, s.getTypeId()); element.addAttribute(ATTRIBUTE_DEFAULT_VALUE, s.getDefaultValue()); for (AnnotationElement a : s.getAnnotationElements()) { makeAnnotation(element, a); } }
Example 14
Source File: MetadataWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void makeFieldElement(Element typeElement, ValueDescriptor v) { Element element = typeElement.newChild(ELEMENT_FIELD); element.addAttribute(ATTRIBUTE_NAME, v.getName()); element.addAttribute(ATTRIBUTE_TYPE_ID, v.getTypeId()); if (v.isArray()) { element.addAttribute(ATTRIBUTE_DIMENSION, 1); } if (PrivateAccess.getInstance().isConstantPool(v)) { element.addAttribute(ATTRIBUTE_CONSTANT_POOL, true); } for (AnnotationElement a : v.getAnnotationElements()) { makeAnnotation(element, a); } }
Example 15
Source File: MetadataWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void makeAnnotation(Element entity, AnnotationElement annotation) { Element element = entity.newChild(ELEMENT_ANNOTATION); element.addAttribute(ATTRIBUTE_TYPE_ID, annotation.getTypeId()); List<Object> values = annotation.getValues(); int index = 0; for (ValueDescriptor v : annotation.getValueDescriptors()) { Object value = values.get(index++); if (v.isArray()) { element.addArrayAttribute(element, v.getName(), value); } else { element.addAttribute(v.getName(), value); } } }