01: package org.vraptor.remote.json;
02:
03: import org.vraptor.remote.OutjectionSerializer;
04:
05: public class JSONSerializer implements OutjectionSerializer {
06:
07: public static final int MAXIMUM_DEPTH_DEFAULT = 3;
08:
09: private int maximumDepth;
10:
11: public JSONSerializer() {
12: this (MAXIMUM_DEPTH_DEFAULT);
13: }
14:
15: public JSONSerializer(int maximumDepth) {
16: this .maximumDepth = maximumDepth;
17: }
18:
19: public CharSequence serialize(Object object) {
20: return new JSONWriter(maximumDepth).write(object);
21: }
22:
23: }
|