コード例 #1
0
 /**
  * @param c
  * @param parent
  */
 private void process(Component c, MessageElement parent) {
   Location loc = c.location();
   Req req = c.req();
   MessageElementData data =
       new MessageElementData(
           loc.uidPath(),
           loc.desc(),
           req.usage().toString(),
           -1,
           null,
           loc.line(),
           loc.column(),
           -1,
           c.position(),
           c.instance(),
           null,
           COMPONENT);
   MessageElement el = new MessageElement(NODE_COMPONENT, data, parent);
   if (c instanceof SimpleComponent) {
     SimpleComponent s = (SimpleComponent) c;
     MessageElementData value =
         new MessageElementData(
             loc.uidPath(),
             loc.desc(),
             req.usage().toString(),
             -1,
             null,
             loc.line(),
             loc.column(),
             -1,
             s.position(),
             c.instance(),
             s.value().raw(),
             COMPONENT);
     new MessageElement("value", value, el);
   } else {
     ComplexComponent cc = (ComplexComponent) c;
     List<SimpleComponent> children = cc.children();
     if (children != null && !children.isEmpty()) {
       Iterator<SimpleComponent> it = children.iterator();
       while (it.hasNext()) {
         process(it.next(), el);
       }
     }
   }
 }
コード例 #2
0
 /**
  * @param s
  * @param parent
  */
 private void process(SimpleComponent s, MessageElement parent) {
   Location loc = s.location();
   Req req = s.req();
   MessageElementData data =
       new MessageElementData(
           loc.uidPath(),
           loc.desc(),
           req.usage().toString(),
           -1,
           null,
           loc.line(),
           loc.column(),
           -1,
           s.position(),
           s.instance(),
           null,
           SUB_COMPONENT);
   MessageElement el = new MessageElement(NODE_SUB_COMPONENT, data, parent);
   MessageElementData value =
       new MessageElementData(
           loc.uidPath(),
           loc.desc(),
           req.usage().toString(),
           -1,
           null,
           loc.line(),
           loc.column(),
           -1,
           s.position(),
           s.instance(),
           s.value().raw(),
           SUB_COMPONENT);
   new MessageElement("value", value, el);
 }