Beispiel #1
0
  /** Process the end of this element. */
  public void end() throws Exception {

    // Identify the objects to be used
    Object child = digester.peek(0);
    Object parent = digester.root;
    if (digester.log.isLoggable(Level.FINE)) {
      if (parent == null) {
        digester.log.fine(
            "[SetRootRule]{"
                + digester.match
                + "} Call [NULL ROOT]."
                + methodName
                + "("
                + child
                + ")");
      } else {
        digester.log.fine(
            "[SetRootRule]{"
                + digester.match
                + "} Call "
                + parent.getClass().getName()
                + "."
                + methodName
                + "("
                + child
                + ")");
      }
    }

    // Call the specified method
    IntrospectionUtils.callMethod1(parent, methodName, child, paramType, digester.getClassLoader());
  }
Beispiel #2
0
  public static void setAttributes(Object o, Node parent) {
    NamedNodeMap attrs = parent.getAttributes();
    if (attrs == null) return;

    for (int i = 0; i < attrs.getLength(); i++) {
      Node n = attrs.item(i);
      String name = n.getNodeName();
      String value = n.getNodeValue();

      if (log.isLoggable(Level.FINEST))
        log.finest("Attribute " + parent.getNodeName() + " " + name + "=" + value);
      try {
        IntrospectionUtils.setProperty(o, name, value);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    }
  }