1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package net.sf.json.sample;
18
19 import net.sf.json.JSONException;
20 import net.sf.json.util.JsonEventListener;
21
22
23
24
25 public class JsonEventAdpater implements JsonEventListener {
26 private int arrayEnd = 0;
27 private int arrayStart = 0;
28 private int elementAdded = 0;
29 private int error = 0;
30 private int objectEnd = 0;
31 private int objectStart = 0;
32 private int propertySet = 0;
33 private int warning = 0;
34
35 public int getArrayEnd() {
36 return arrayEnd;
37 }
38
39 public int getArrayStart() {
40 return arrayStart;
41 }
42
43 public int getElementAdded() {
44 return elementAdded;
45 }
46
47 public int getError() {
48 return error;
49 }
50
51 public int getObjectEnd() {
52 return objectEnd;
53 }
54
55 public int getObjectStart() {
56 return objectStart;
57 }
58
59 public int getPropertySet() {
60 return propertySet;
61 }
62
63 public int getWarning() {
64 return warning;
65 }
66
67 public void onArrayEnd() {
68 arrayEnd++;
69 }
70
71 public void onArrayStart() {
72 arrayStart++;
73 }
74
75 public void onElementAdded( int index, Object element ) {
76 elementAdded++;
77 }
78
79 public void onError( JSONException jsone ) {
80 error++;
81 }
82
83 public void onObjectEnd() {
84 objectEnd++;
85 }
86
87 public void onObjectStart() {
88 objectStart++;
89 }
90
91 public void onPropertySet( String key, Object value, boolean accumulated ) {
92 propertySet++;
93 }
94
95 public void onWarning( String warning ) {
96 this.warning++;
97 }
98
99 public void reset() {
100 objectStart = 0;
101 objectEnd = 0;
102 arrayStart = 0;
103 arrayEnd = 0;
104 error = 0;
105 warning = 0;
106 propertySet = 0;
107 elementAdded = 0;
108 }
109 }