コード例 #1
0
 public XMLNode toNode(MetaRelations object) throws Exception {
   XMLNode node = new XMLNode("meta-relations");
   Attributes attrs = new Attributes(node);
   Object2XML mapper = Object2XML.getInstance();
   mapper.addNode(object.getMetaId(), node, false, "id");
   mapper.addNode(
       object.getMetaRelations(),
       node,
       false,
       "items",
       "item",
       "org.vietspider.bean.MetaRelation");
   return node;
 }
コード例 #2
0
 public void toField(MetaRelations object, XMLNode node, String name, String value)
     throws Exception {
   if (name.equals("id")) {
     object.setMetaId(XML2Object.getInstance().toValue(String.class, value));
     return;
   }
   if (name.equals("items")) {
     List<MetaRelation> list = null;
     list = object.getMetaRelations();
     if (list == null) list = new ArrayList<MetaRelation>();
     XML2Object.getInstance().mapCollection(list, MetaRelation.class, node);
     object.setMetaRelations(list);
     return;
   }
 }