Пример #1
0
 public void toJSON(Object obj, Output out) {
   if (_fromJSON) {
     out.addClass(obj.getClass());
     out.add("value", ((Enum) obj).name());
   } else {
     out.add(((Enum) obj).name());
   }
 }
Пример #2
0
 public void toJSON(Object obj, Output out) {
   if (_fromJSON) {
     out.addClass(obj.getClass());
     out.add("value", obj.toString());
   } else {
     out.add(obj.toString());
   }
 }
Пример #3
0
 /* ------------------------------------------------------------ */
 public void toJSON(Object obj, Output out) {
   if (_fromJSON) out.addClass(_pojoClass);
   for (Map.Entry<String, Method> entry : _getters.entrySet()) {
     try {
       out.add(entry.getKey(), entry.getValue().invoke(obj, GETTER_ARG));
     } catch (Exception e) {
       // TODO throw exception?
       LOG.warn("{} property '{}' excluded. (errors)", _pojoClass.getName(), entry.getKey());
       log(e);
     }
   }
 }
Пример #4
0
 @Override
 public void toJSON(Object arg0, Output arg1) {
   if (arg0 == null) {
     arg1.add(null);
     return;
   }
   TokenizedField tf = (TokenizedField) arg0;
   arg1.add(FieldNameTag, tf.getFieldName());
   arg1.add(TermsTag, tf.getTerms());
   arg1.add(TFScoresTag, tf.getTF());
   arg1.add(FieldIsPublicTag, tf.isPublic());
 }
Пример #5
0
 public void toJSON(Output out) {
   out.addClass(Woggle.class);
   out.add("name", name);
   out.add("nested", nested);
   out.add("number", number);
 }