@Override
 public void serialize(final DomElement src, final JsonWriter out)
     throws IOException, InvocationTargetException, IllegalAccessException {
   final Map<String, String> attrs = src.getAttrs();
   final String html = src.getHtml();
   if ((attrs == null || attrs.isEmpty()) && html == null) {
     out.writeObject(src.getTag());
   } else {
     out.beginObject();
     out.writeProperty("tag", src.getTag());
     if (attrs != null)
       for (Map.Entry<String, String> attr : attrs.entrySet()) {
         out.writeProperty(attr.getKey(), attr.getValue());
       }
     if (html != null) out.writeProperty("html", html);
     out.endObject();
   }
 }
示例#2
0
 @Override
 public void serialize(final JsonWriter out) throws Exception {
   if (anchorSize != null && !anchorSize.isEmpty()) out.writeProperty("anchorSize", anchorSize);
   super.serialize(out);
 }