Beispiel #1
0
 public static boolean isValueNode(Node node) {
   Class nodeClass = node.getClass();
   return nodeClass == Node.class
       || nodeClass == ApplicationNode.class
       || nodeClass == ArrayNode.class
       || node instanceof PrimitiveNode
       || nodeClass == XMLNode.class
       || nodeClass == XMLListNode.class
       || nodeClass == ModelNode.class
       || nodeClass == InlineComponentNode.class;
 }
  public void processRequest(Node node) {
    graph = new AnonymousObjectGraph(document, typeTable.objectType, node.beginLine);

    if (node.getChildCount() == 1 && node.getChildAt(0) instanceof CDATANode) {
      /** <requestName>{binding_expression}</requestName> */
      CDATANode cdata = (CDATANode) node.getChildAt(0);
      if (cdata.image.length() > 0) {
        String bindingExprString = TextParser.getBindingExpressionFromString(cdata.image);
        if (bindingExprString != null) {
          BindingExpression bexpr =
              new BindingExpression(bindingExprString, cdata.beginLine, document);
          bexpr.setDestination(graph);
        } else {
          log(cdata, new ModelBuilder.OnlyScalarError(requestName));
        }
      }
    } else {
      /** <requestName> <foo>...</foo> <bar>...</bar> ... </requestName> */
      processChildren(node, graph);
    }
  }
Beispiel #3
0
  public void invoke(Node node) {
    Class nodeClass = node.getClass();

    if (nodeClass == Node.class || nodeClass == ApplicationNode.class) {
      componentNode(node);
    } else if (nodeClass == ArrayNode.class) {
      arrayNode((ArrayNode) node);
    } else if (node instanceof PrimitiveNode) {
      primitiveNode((PrimitiveNode) node);
    } else if (nodeClass == XMLNode.class) {
      xmlNode((XMLNode) node);
    } else if (nodeClass == XMLListNode.class) {
      xmlListNode((XMLListNode) node);
    } else if (nodeClass == ModelNode.class) {
      modelNode((ModelNode) node);
    } else if (nodeClass == InlineComponentNode.class) {
      inlineComponentNode((InlineComponentNode) node);
    } else {
      assert !isValueNode(node) : "value node class not handled by invoke()";
      unknown(node);
    }
  }