コード例 #1
0
 @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;
 }
コード例 #2
0
  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;
  }
コード例 #3
0
 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;
 }