public void transform(Object object) { TypeContext typeContext= getContext().writeOpenArray(); int length= Array.getLength(object); for (int i= 0; i < length; ++i) { if (!typeContext.isFirst()) getContext().writeComma(); typeContext.setFirst(false); getContext().transform(Array.get(object, i)); } getContext().writeCloseArray(); }
public void transform(Object object) { JSONContext context= getContext(); Path path= context.getPath(); String name= ((Class) object).getName(); name= name.replaceAll("_", ".");//TODO mejorar!!! TypeContext typeContext= context.writeOpenObject(); context.writeName("name"); context.writeQuoted(name); context.writeComma(); context.writeName("class"); context.writeQuoted("java.lang.Class"); context.writeCloseObject(); } }
context.writeComma(); context.writeName("class"); ClassTransformer classTransformer= new ClassTransformer();
getContext().writeComma(); typeContext.setFirst(false); if (key != null)
public void transform(Object object) { Iterable iterable= (Iterable) object; TypeContext typeContext= getContext().writeOpenArray(); for (Object item : iterable) { if (!typeContext.isFirst()) getContext().writeComma(); typeContext.setFirst(false); getContext().transform(item); } getContext().writeCloseArray(); }
context.write("" + objectId); context.writeComma(); for (BeanProperty prop : analyzer.getProperties()) context.writeComma(); typeContext.setFirst(false); context.writeName(name);