public void toJSON(Object obj, Output out) { if (_fromJSON) { out.addClass(obj.getClass()); out.add("value", obj.toString()); } else { out.add(obj.toString()); } }
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()); } }
/* ------------------------------------------------------------ */ 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); } } }
public void toJSON(Output out) { out.addClass(Woggle.class); out.add("name", name); out.add("nested", nested); out.add("number", number); }