File tree 2 files changed +41
-2
lines changed
binding/src/main/java/org/jsonx
2 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,44 @@ public final class JxDecoder {
33
33
public static final JxDecoder VALIDATING = new JxDecoder (true );
34
34
public static final JxDecoder NON_VALIDATING = new JxDecoder (false );
35
35
36
+ private static JxDecoder global = NON_VALIDATING ;
37
+
38
+ /**
39
+ * Returns the {@link JxDecoder} for the provided validation boolean,
40
+ * specifying whether the {@link JxDecoder} is to validate JSON documents
41
+ * while parsing.
42
+ *
43
+ * @param validating Whether the {@link JxDecoder} is to validate JSON
44
+ * documents while parsing.
45
+ * @return The {@link JxDecoder} for the provided validation boolean,
46
+ * specifying whether the {@link JxDecoder} is to validate JSON
47
+ * documents while parsing.
48
+ */
49
+ public static JxDecoder get (final boolean validating ) {
50
+ return validating ? VALIDATING : NON_VALIDATING ;
51
+ }
52
+
53
+ /**
54
+ * Returns the global {@link JxDecoder}.
55
+ *
56
+ * @return The global {@link JxDecoder}.
57
+ * @see #set(JxDecoder)
58
+ */
59
+ public static JxDecoder get () {
60
+ return global ;
61
+ }
62
+
63
+ /**
64
+ * Set the global {@link JxDecoder}.
65
+ *
66
+ * @param decoder The {@link JxDecoder}.
67
+ * @return The provided {@link JxDecoder}.
68
+ * @see #get()
69
+ */
70
+ public static JxDecoder set (final JxDecoder decoder ) {
71
+ return global = decoder ;
72
+ }
73
+
36
74
private final boolean validate ;
37
75
38
76
private JxDecoder (final boolean validate ) {
Original file line number Diff line number Diff line change @@ -94,10 +94,11 @@ public static JxEncoder get() {
94
94
* Set the global {@link JxEncoder}.
95
95
*
96
96
* @param encoder The {@link JxEncoder}.
97
+ * @return The provided {@link JxEncoder}.
97
98
* @see #get()
98
99
*/
99
- public static void set (final JxEncoder encoder ) {
100
- global = encoder ;
100
+ public static JxEncoder set (final JxEncoder encoder ) {
101
+ return global = encoder ;
101
102
}
102
103
103
104
final int indent ;
You can’t perform that action at this time.
0 commit comments