jrjackson 0.4.17-java → 0.4.19-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/jrjackson.gemspec +1 -2
  3. data/lib/com/fasterxml/jackson/core/jackson-annotations/2.15.4/jackson-annotations-2.15.4.jar +0 -0
  4. data/lib/com/fasterxml/jackson/core/jackson-core/2.15.4/jackson-core-2.15.4.jar +0 -0
  5. data/lib/com/fasterxml/jackson/core/jackson-databind/2.15.4/jackson-databind-2.15.4.jar +0 -0
  6. data/lib/com/fasterxml/jackson/module/jackson-module-afterburner/{2.14.1/jackson-module-afterburner-2.14.1.jar → 2.15.4/jackson-module-afterburner-2.15.4.jar} +0 -0
  7. data/lib/jrjackson/build_info.rb +8 -8
  8. data/lib/jrjackson/jars/jrjackson-1.2.36.jar +0 -0
  9. data/lib/jrjackson_jars.rb +8 -8
  10. data/pom.xml +47 -10
  11. metadata +14 -79
  12. data/.gitignore +0 -16
  13. data/.jrubyr_c +0 -433
  14. data/Gemfile +0 -12
  15. data/Mavenfile +0 -25
  16. data/Rakefile +0 -39
  17. data/alt_bench.rb +0 -46
  18. data/changelog.md +0 -181
  19. data/lib/com/fasterxml/jackson/core/jackson-annotations/2.14.1/jackson-annotations-2.14.1.jar +0 -0
  20. data/lib/com/fasterxml/jackson/core/jackson-core/2.14.1/jackson-core-2.14.1.jar +0 -0
  21. data/lib/com/fasterxml/jackson/core/jackson-databind/2.14.1/jackson-databind-2.14.1.jar +0 -0
  22. data/lib/jrjackson/jars/jrjackson-1.2.34.jar +0 -0
  23. data/profiling/profiled.rb +0 -15
  24. data/run_all_individual_bench.sh +0 -25
  25. data/run_jruby_individual_bench.sh +0 -20
  26. data/run_mri_individual_bench.sh +0 -7
  27. data/src/main/java/com/jrjackson/IParseHandler.java +0 -53
  28. data/src/main/java/com/jrjackson/JavaBigDecimalValueConverter.java +0 -17
  29. data/src/main/java/com/jrjackson/JavaBigIntValueConverter.java +0 -17
  30. data/src/main/java/com/jrjackson/JavaConverter.java +0 -10
  31. data/src/main/java/com/jrjackson/JavaFloatValueConverter.java +0 -16
  32. data/src/main/java/com/jrjackson/JavaHandler.java +0 -118
  33. data/src/main/java/com/jrjackson/JavaLongValueConverter.java +0 -16
  34. data/src/main/java/com/jrjackson/JjParse.java +0 -139
  35. data/src/main/java/com/jrjackson/JrJacksonBase.java +0 -152
  36. data/src/main/java/com/jrjackson/JrJacksonJava.java +0 -81
  37. data/src/main/java/com/jrjackson/JrJacksonRaw.java +0 -108
  38. data/src/main/java/com/jrjackson/JrJacksonRuby.java +0 -89
  39. data/src/main/java/com/jrjackson/JrJacksonSaj.java +0 -26
  40. data/src/main/java/com/jrjackson/JrJacksonSch.java +0 -25
  41. data/src/main/java/com/jrjackson/JrJacksonService.java +0 -38
  42. data/src/main/java/com/jrjackson/JrParse.java +0 -142
  43. data/src/main/java/com/jrjackson/ParseError.java +0 -16
  44. data/src/main/java/com/jrjackson/RubyAnySerializer.java +0 -291
  45. data/src/main/java/com/jrjackson/RubyBigDecimalValueConverter.java +0 -18
  46. data/src/main/java/com/jrjackson/RubyBigIntValueConverter.java +0 -21
  47. data/src/main/java/com/jrjackson/RubyConverter.java +0 -12
  48. data/src/main/java/com/jrjackson/RubyDateFormat.java +0 -34
  49. data/src/main/java/com/jrjackson/RubyFloatValueConverter.java +0 -18
  50. data/src/main/java/com/jrjackson/RubyHandler.java +0 -119
  51. data/src/main/java/com/jrjackson/RubyIntValueConverter.java +0 -18
  52. data/src/main/java/com/jrjackson/RubyJacksonModule.java +0 -80
  53. data/src/main/java/com/jrjackson/RubyKeyConverter.java +0 -12
  54. data/src/main/java/com/jrjackson/RubyNameConverter.java +0 -9
  55. data/src/main/java/com/jrjackson/RubyObjectDeserializer.java +0 -182
  56. data/src/main/java/com/jrjackson/RubyStringConverter.java +0 -18
  57. data/src/main/java/com/jrjackson/RubyStringKeyConverter.java +0 -15
  58. data/src/main/java/com/jrjackson/RubyStringNameConverter.java +0 -12
  59. data/src/main/java/com/jrjackson/RubySymbolKeyConverter.java +0 -15
  60. data/src/main/java/com/jrjackson/RubySymbolNameConverter.java +0 -12
  61. data/src/main/java/com/jrjackson/RubyUtils.java +0 -149
  62. data/src/main/java/com/jrjackson/SajParse.java +0 -169
  63. data/src/main/java/com/jrjackson/SchParse.java +0 -209
  64. data/src/main/java/com/jrjackson/StreamParse.java +0 -66
  65. data/src/test/java/com/jrjackson/RubyAnySerializerTest.java +0 -56
  66. data/test/jrjackson_test.rb +0 -578
data/changelog.md DELETED
@@ -1,181 +0,0 @@
1
- v0.4.17
2
- Bump jackson and jackson-databind to v2.14.1
3
-
4
- v0.4.16
5
- Publish v0.4.15 again without world writable files
6
-
7
- v0.4.15
8
- Bump jackson and jackson-databind to v2.13.3
9
-
10
- v0.4.14
11
- Bump jackson-databind to v2.9.10.8
12
-
13
- v0.4.13
14
- Bump jackson-databind to v2.9.10.6
15
-
16
- v0.4.12
17
- Bump jackson-databind to v2.9.10.4
18
-
19
- v0.4.11
20
- Bump Jackson to v2.9.10, and jackson-databind to v2.9.10.1
21
-
22
- v0.4.10
23
- fix concurrency issue when serializing dates.
24
- Cache UTC TimeZone class to avoid unnecessary calls to synchronized method
25
- Use a ThreadLocal to hold per-thread instances of SimpleDateFormat to avoid
26
- unnecessary expensive clonings of that object
27
- Replace unsafe call to setDateFormat on static ObjectMapper class by creating
28
- an amended SerializationConfig
29
-
30
- v0.4.9
31
- bump Jackson to v2.9.9, and jackson-databind to v2.9.9.3
32
-
33
- v0.4.8
34
- fix serialisation of big numbers as Ruby 2.4 unifies Fixnum and Bignum into Integer
35
-
36
- v0.4.4
37
- fix for issue 64
38
- Ruby parse() null/nil handling
39
-
40
- v0.4.3
41
- bump Jackson to v2.9.1
42
- make static_mapper public
43
-
44
- v0.4.1
45
- fix for issue 55
46
- Refactor AnySerializer acceptable class detection that does not use an exception
47
-
48
- v0.4.0
49
- Implement `to_s` and Exception serialization
50
-
51
- v0.3.9
52
- Thanks to mkristian, now uses jar_dependencies
53
- Upgrade to Jackson v2.7.1
54
- fix for issue 51
55
- dont create "new RubyJacksonModule()" when creating a Provider
56
- fix for reports of symbol table overflow in Jackson when using JrJackson in very long running daemons (Logstash)
57
- disable the FAIL_ON_SYMBOL_HASH_OVERFLOW setting
58
-
59
- v0.3.8
60
- fix for issue 47
61
- Update Jackson to v 2.6.3
62
- Change error message to better report failure in issue 46
63
-
64
- v0.3.7
65
- fix for issue 46
66
- Add references to RubyAnySerializer so Jackson can
67
- use it for Ruby objects nested in Java objects
68
-
69
- v0.3.6
70
- fix for issue 45
71
- use bytelist.begin instead of 0 generating from RubyString
72
-
73
- v0.3.5
74
- give highest precedence to the to_json_data method
75
-
76
- v0.3.4
77
- fix multi_json bug
78
- not serializing non-string keys
79
-
80
- v0.3.3
81
- fix bigdecimal bug
82
- add require bigdecimal
83
-
84
- v0.3.2
85
- update changelog
86
-
87
- v0.3.1
88
- remove old jar
89
-
90
- v0.3.0
91
- this is a major refactor.
92
- parse and generate performance improvements.
93
- see JrJackson::Ruby and JrJackson::Java modules
94
- pretty generation support.
95
- jruby 9.0.1.0 and 1.7.22
96
- jackson 2.6.1
97
-
98
- v0.2.9
99
- fix for issue 39
100
- incorrect error when serializing BasicObject
101
-
102
- v0.2.8
103
- fixes for issues-28,29,31
104
- correction for Time#to_s
105
- new options to control date serialization
106
- optimizations suggested by @headius
107
- jar compiled for jruby 1.7.17
108
- jruby 1.7.17
109
- jackson 2.4.4
110
-
111
- v0.2.7
112
- fixes for issues-23,24
113
- add to_time as option for serializing Time like objects
114
- jar compiled for jruby 1.7.11
115
-
116
- v0.2.6
117
- fix issue-20
118
- allow jruby to convert Ruby StringIO into Java
119
- by not type checking passed arg
120
- this is because jruby 1.7.9 has changed the type of java object backing Ruby StringIO
121
- jar compiled for jruby 1.7.8 (jruby 1.7.9 in the maven repo has an error in the pom.xml)
122
- jruby 1.7.8, jruby 1.7.9 (tested)
123
- jackson 2.3.0
124
-
125
- v0.2.5
126
- fix issue-16
127
- reduce the gem size by:
128
- change pom.xml to only include relevant java jars
129
- exclude benchmaking from the gemspec files
130
- jruby 1.7.5
131
- jackson 2.2.3
132
-
133
- v0.2.4
134
- fix issue-15
135
- return Ruby nil instead of Java null
136
- fix issue-14
137
- remove all usage of Ruby.getGlobalRuntime
138
- pass the runtime from the calling Ruby ThreadContext into the deserializers and converters
139
- jruby 1.7.5
140
- jackson 2.2.3
141
-
142
- v0.2.3
143
- fix issue-12
144
- improve the serialization support for non Json Datatype Ruby objects
145
- now has support for serializing via toJava, to_h, to_hash, to_a, to_json
146
- fix for failing MultiJson unicode test
147
- jruby 1.7.4
148
- jackson 2.2.3
149
-
150
- v0.2.2
151
- fix issue-13
152
- compile Java for 1.6 compatibility
153
- documentation tweaks
154
- jruby 1.7.4
155
- jackson 2.2.3
156
-
157
- v0.2.1
158
- documentation tweaks
159
- fix issue-7
160
- add pluggable String and Symbol Converters for JSON values
161
- jruby 1.7.4
162
- jackson 2.2.3
163
-
164
- v0.2.0
165
- extract all Java -> Ruby generation to reusable RubyUtils static class
166
- support BigDecimal
167
- remove JSON Api
168
- fixes issues 5, 6, 8,
169
-
170
- jruby 1.7.3
171
- jackson 2.2.2
172
-
173
- v0.1.1
174
- fix Time regex
175
- v0.1.0
176
- MutiJson compatibility
177
- switch to using almost all Java, i.e. define most of the ruby modules in Java
178
- jruby 1.7.3
179
- jackson 2.1.4
180
- v0.0.7
181
- first release - minimal jruby wrapper around jackson 1.9.5 jars
@@ -1,15 +0,0 @@
1
- require 'rubygems'
2
- require 'jruby-prof'
3
- require 'jrjackson_r'
4
-
5
- js = %({"one":1,"two":"deux","three":[333.333,66.666]})
6
-
7
- result = JRubyProf.profile do
8
- JrJackson::Json.parse js
9
- end
10
-
11
- JRubyProf.print_flat_text result, "flat.txt"
12
- JRubyProf.print_graph_text result, "graph.txt"
13
- JRubyProf.print_graph_html result, "graph.html"
14
- JRubyProf.print_call_tree result, "call_tree.txt"
15
- JRubyProf.print_tree_html result, "call_tree.html"
@@ -1,25 +0,0 @@
1
- #!/bin/sh
2
-
3
- chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/json-mri-sourced.rb
4
- chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/oj-mri-sourced.rb
5
-
6
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-jr-sourced.rb
7
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-jr-sourced.rb
8
-
9
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/string-jr-sourced.rb
10
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/str-bd-jr-sourced.rb
11
-
12
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/symbol-jr-sourced.rb
13
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/sym-bd-jr-sourced.rb
14
-
15
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-jr-sourced.rb
16
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-bd-jr-sourced.rb
17
-
18
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/sj-jr-sourced.rb
19
-
20
- chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/json-gen-mri-sourced.rb
21
- chruby-exec ruby-2.2.2 -- ruby benchmarking/individual/oj-gen-mri-sourced.rb
22
-
23
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/json-gen-jr-sourced.rb
24
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/gson-gen-jr-sourced.rb
25
- chruby-exec jruby-9.2.0.0 -- ruby -J-Xmn512m -J-Xms2048m -J-Xmx2048m benchmarking/individual/raw-gen-jr-sourced.rb
@@ -1,20 +0,0 @@
1
- #!/bin/sh
2
-
3
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/json-gen-jr-sourced.rb
4
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/gson-gen-jr-sourced.rb
5
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/raw-gen-jr-sourced.rb
6
-
7
- # jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/gson-jr-sourced.rb
8
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/json-jr-sourced.rb
9
-
10
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/string-jr-sourced.rb
11
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/str-bd-jr-sourced.rb
12
-
13
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/symbol-jr-sourced.rb
14
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/sym-bd-jr-sourced.rb
15
-
16
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/raw-jr-sourced.rb
17
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/raw-bd-jr-sourced.rb
18
-
19
- jruby -J-Xmn1024m -J-Xms4096m -J-Xmx4096m -S ./benchmarking/individual/sj-jr-sourced.rb
20
-
@@ -1,7 +0,0 @@
1
- #!/bin/sh
2
-
3
- ruby ./benchmarking/individual/json-mri-sourced.rb
4
- ruby ./benchmarking/individual/oj-mri-sourced.rb
5
-
6
- ruby ./benchmarking/individual/json-gen-mri-sourced.rb
7
- ruby ./benchmarking/individual/oj-gen-mri-sourced.rb
@@ -1,53 +0,0 @@
1
- /*
2
- * To change this license header, choose License Headers in Project Properties.
3
- * To change this template file, choose Tools | Templates
4
- * and open the template in the editor.
5
- */
6
- package com.jrjackson;
7
-
8
- import com.fasterxml.jackson.core.JsonParser;
9
- import java.io.IOException;
10
-
11
- /**
12
- *
13
- * @author guy
14
- * @param <T>
15
- * @param <U>
16
- * @param <V>
17
- */
18
- public interface IParseHandler<T, U, V> {
19
-
20
- void addValue(T value);
21
-
22
- void arrayAppend(U array, T value);
23
-
24
- void arrayEnd();
25
-
26
- T arrayStart();
27
-
28
- T falseValue();
29
-
30
- T getResult();
31
-
32
- void hashEnd();
33
-
34
- T hashKey(String key);
35
-
36
- void hashSet(V hash, T key, T value);
37
-
38
- T hashStart();
39
-
40
- void raiseError(String e);
41
-
42
- T treatFloat(JsonParser jp) throws IOException;
43
-
44
- T treatInt(JsonParser jp) throws IOException;
45
-
46
- T treatNull();
47
-
48
- T treatString(JsonParser jp) throws IOException;
49
-
50
- T trueValue();
51
-
52
-
53
- }
@@ -1,17 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.JsonParser;
4
- import java.io.IOException;
5
- import java.math.BigDecimal;
6
-
7
- /**
8
- *
9
- * @author Guy Boertje
10
- */
11
- public class JavaBigDecimalValueConverter implements JavaConverter {
12
-
13
- @Override
14
- public BigDecimal convert(JsonParser jp) throws IOException {
15
- return jp.getDecimalValue();
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.JsonParser;
4
- import java.io.IOException;
5
- import java.math.BigInteger;
6
-
7
- /**
8
- *
9
- * @author Guy Boertje
10
- */
11
- public class JavaBigIntValueConverter implements JavaConverter {
12
-
13
- @Override
14
- public BigInteger convert(JsonParser jp) throws IOException {
15
- return jp.getBigIntegerValue();
16
- }
17
- }
@@ -1,10 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.*;
4
-
5
- import java.io.IOException;
6
-
7
- public interface JavaConverter {
8
-
9
- public Object convert(JsonParser jp) throws IOException;
10
- }
@@ -1,16 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.JsonParser;
4
- import java.io.IOException;
5
-
6
- /**
7
- *
8
- * @author Guy Boertje
9
- */
10
- public class JavaFloatValueConverter implements JavaConverter {
11
-
12
- @Override
13
- public Double convert(JsonParser jp) throws IOException {
14
- return jp.getDoubleValue();
15
- }
16
- }
@@ -1,118 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.JsonParser;
4
- import java.io.IOException;
5
- import java.util.ArrayList;
6
- import java.util.HashMap;
7
-
8
-
9
- /**
10
- *
11
- * @author Guy Boertje
12
- */
13
-
14
- /*
15
- Long -> Integer
16
- Double -> Float
17
- JavaMath::BigDecimal -> BigDecimal
18
- JavaMath::BigInteger -> Bignum
19
- JavaUtil::ArrayList -> Array
20
- JavaUtil::LinkedHashMap -> Hash
21
- String -> String
22
- */
23
-
24
- public class JavaHandler implements IParseHandler<Object, ArrayList<Object>, HashMap<String, Object>> {
25
-
26
- private Object _result;
27
- private final JavaConverter _intConv;
28
- private final JavaConverter _floatConv;
29
-
30
- public JavaHandler(
31
- JavaConverter intConverter,
32
- JavaConverter floatConverter) {
33
-
34
- _intConv = intConverter;
35
- _floatConv = floatConverter;
36
-
37
- }
38
-
39
- @Override
40
- public void addValue(Object value) {
41
- _result = value;
42
- }
43
-
44
- @Override
45
- public Object hashStart() {
46
- return new HashMap<String, Object>();
47
- }
48
-
49
- @Override
50
- public void hashEnd() {
51
-
52
- }
53
-
54
- @Override
55
- public Object hashKey(String key) {
56
- return key;
57
- }
58
-
59
- @Override
60
- public void hashSet(HashMap<String, Object> hash, Object key, Object value) {
61
- hash.put((String)key, value);
62
- }
63
-
64
- @Override
65
- public Object arrayStart() {
66
- return new ArrayList<Object>();
67
- }
68
-
69
- @Override
70
- public void arrayEnd() {
71
-
72
- }
73
-
74
- @Override
75
- public void arrayAppend(ArrayList<Object> array, Object value) {
76
- array.add(value);
77
- }
78
-
79
- @Override
80
- public Object treatNull() {
81
- return null;
82
- }
83
-
84
- @Override
85
- public Object treatInt(JsonParser jp) throws IOException {
86
- return _intConv.convert(jp);
87
- }
88
-
89
- @Override
90
- public Object treatFloat(JsonParser jp) throws IOException {
91
- return _floatConv.convert(jp);
92
- }
93
-
94
- @Override
95
- public Object treatString(JsonParser jp) throws IOException {
96
- return jp.getText();
97
- }
98
-
99
- @Override
100
- public Object trueValue() {
101
- return true;
102
- }
103
-
104
- @Override
105
- public Object falseValue() {
106
- return false;
107
- }
108
-
109
- @Override
110
- public Object getResult() {
111
- return _result;
112
- }
113
-
114
- @Override
115
- public void raiseError(String e) {
116
-
117
- }
118
- }
@@ -1,16 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.JsonParser;
4
- import java.io.IOException;
5
-
6
- /**
7
- *
8
- * @author Guy Boertje
9
- */
10
- public class JavaLongValueConverter implements JavaConverter {
11
-
12
- @Override
13
- public Long convert(JsonParser jp) throws IOException {
14
- return jp.getLongValue();
15
- }
16
- }
@@ -1,139 +0,0 @@
1
- package com.jrjackson;
2
-
3
- import com.fasterxml.jackson.core.JsonParser;
4
- import com.fasterxml.jackson.core.JsonStreamContext;
5
-
6
- import java.io.IOException;
7
- import java.util.ArrayList;
8
- import java.util.HashMap;
9
-
10
- /**
11
- *
12
- * @author Guy Boertje
13
- */
14
- public class JjParse {
15
-
16
- private final JavaHandler _handler;
17
- private final HashMap<JsonStreamContext, Object> _objectMap = new HashMap<>();
18
- private JsonStreamContext _deepestContext;
19
-
20
- public JjParse(JavaHandler handler) {
21
- _handler = handler;
22
- }
23
-
24
- public void deserialize(JsonParser jp) throws IOException {
25
- try {
26
-
27
- while (jp.nextValue() != null) {
28
- handleJavaToken(jp);
29
- }
30
- } catch (IOException e) {
31
- _handler.raiseError(e.getLocalizedMessage());
32
- }
33
- }
34
-
35
- private void addJavaValue(JsonStreamContext x) {
36
- JsonStreamContext px = x.getParent();
37
- Object dtarget = _objectMap.get(_deepestContext);
38
-
39
- if (px == null) {
40
- _handler.addValue(dtarget);
41
- return;
42
- }
43
-
44
- Object value = _objectMap.get(x);
45
-
46
- if (x.inArray()) {
47
- _handler.arrayAppend(
48
- (ArrayList<Object>)value, dtarget);
49
- } else if (x.inObject()) {
50
- _handler.hashSet(
51
- (HashMap<String, Object>)value, getJavaHashKey(x), dtarget);
52
-
53
- } else {
54
- _handler.addValue(value);
55
- }
56
- }
57
-
58
- private void addJavaValue(JsonStreamContext x, Object val) {
59
- if (x.inArray()) {
60
- ArrayList<Object> a = (ArrayList<Object>)_objectMap.get(x);
61
- _handler.arrayAppend(a, val);
62
- } else if (x.inObject()) {
63
- HashMap<String, Object> h = (HashMap<String, Object>)_objectMap.get(x);
64
- _handler.hashSet(h, getJavaHashKey(x), val);
65
-
66
- } else {
67
- _handler.addValue(val);
68
- }
69
- }
70
-
71
- private String getJavaHashKey(JsonStreamContext x) {
72
- String k = x.getCurrentName();
73
- if (k == null) {
74
- return null;
75
- }
76
- return (String)_handler.hashKey(k);
77
- }
78
-
79
- protected void handleJavaToken(JsonParser jp)
80
- throws IOException {
81
-
82
- JsonStreamContext cx = jp.getParsingContext();
83
-
84
- switch (jp.getCurrentToken()) {
85
- case START_OBJECT:
86
- _deepestContext = cx;
87
- _objectMap.put(cx, _handler.hashStart());
88
- break;
89
-
90
- case START_ARRAY:
91
- _deepestContext = cx;
92
- _objectMap.put(cx, _handler.arrayStart());
93
-
94
- case FIELD_NAME:
95
- break;
96
-
97
- case VALUE_EMBEDDED_OBJECT:
98
- System.out.println("-------- VALUE_EMBEDDED_OBJECT ????????? --------");
99
- System.out.println(jp.getEmbeddedObject());
100
- break;
101
-
102
- case VALUE_STRING:
103
- addJavaValue(cx, _handler.treatString(jp));
104
- break;
105
-
106
- case VALUE_NUMBER_INT:
107
- addJavaValue(cx, _handler.treatInt(jp));
108
- break;
109
-
110
- case VALUE_NUMBER_FLOAT:
111
- addJavaValue(cx, _handler.treatFloat(jp));
112
- break;
113
-
114
- case VALUE_TRUE:
115
- addJavaValue(cx, _handler.trueValue());
116
- break;
117
-
118
- case VALUE_FALSE:
119
- addJavaValue(cx, _handler.falseValue());
120
- break;
121
-
122
- case VALUE_NULL: // should not get this but...
123
- addJavaValue(cx, _handler.treatNull());
124
- break;
125
-
126
- case END_ARRAY:
127
- _handler.arrayEnd();
128
- addJavaValue(cx);
129
- _deepestContext = cx;
130
- break;
131
-
132
- case END_OBJECT:
133
- _handler.hashEnd();
134
- addJavaValue(cx);
135
- _deepestContext = cx;
136
- break;
137
- }
138
- }
139
- }