@Override public TypedProperties unmarshal(PropertiesType props) throws Exception { TypedProperties tp = new TypedProperties(); if (props != null && props.properties != null) { for (Property p : props.properties) { tp.put(p.name, p.value); } } return tp; }
public static Properties extractProperties(Element source) { TypedProperties p = new TypedProperties(); NodeList list = source.getElementsByTagName("property"); if (list == null) return null; // loop through attributes for (int loop = 0; loop < list.getLength(); loop++) { Node node = list.item(loop); if (node.getNodeType() != Node.ELEMENT_NODE) continue; // for each element (attribute) ... Element element = (Element) node; String name = element.getAttribute("name"); String valueStr = element.getAttribute("value"); if (valueStr.length() > 0) { valueStr = valueStr.trim(); valueStr = StringPropertyReplacer.replaceProperties(valueStr); p.put(name, valueStr); } } return p.isEmpty() ? null : p; }
public InterceptorConfigurationBuilder addProperty(String key, String value) { TypedProperties properties = attributes.attribute(PROPERTIES).get(); properties.put(key, value); attributes.attribute(PROPERTIES).set(TypedProperties.toTypedProperties(properties)); return this; }