1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.primefaces.extensions.model.monacoeditor;
25
26 import org.primefaces.shaded.json.*;
27 import java.io.ObjectStreamException;
28 import java.io.Serializable;
29
30
31
32
33
34
35
36
37
38 @SuppressWarnings("serial")
39 public class EditorUnicodeHighlightOptions extends JSONObject implements Serializable {
40 private Object writeReplace() throws ObjectStreamException {
41 return new SerializedEditorUnicodeHighlightOptions(this);
42 }
43
44 private static class SerializedEditorUnicodeHighlightOptions implements Serializable {
45 private String json;
46
47 public SerializedEditorUnicodeHighlightOptions(EditorUnicodeHighlightOptions editorUnicodeHighlightOptions) {
48 this.json = editorUnicodeHighlightOptions.toString();
49 }
50
51 private Object readResolve() throws ObjectStreamException {
52 final EditorUnicodeHighlightOptions editorUnicodeHighlightOptions = new EditorUnicodeHighlightOptions();
53 final JSONObject data = new JSONObject(json);
54 for (final String key : data.keySet()) {
55 final Object value = data.get(key);
56 editorUnicodeHighlightOptions.put(key, value);
57 }
58 return editorUnicodeHighlightOptions;
59 }
60 }
61
62
63
64
65 public JSONObject getAllowedCharacters() {
66 return (JSONObject) (has("allowedCharacters") ? get("allowedCharacters") : null);
67 }
68
69
70
71
72
73 public EditorUnicodeHighlightOptions setAllowedCharacters(final JSONObject allowedCharacters) {
74 put("allowedCharacters", allowedCharacters);
75 return this;
76 }
77
78
79
80
81
82
83
84 public EditorUnicodeHighlightOptions addAllowedCharacter(final String key, final Boolean value) {
85 JSONObject x = getAllowedCharacters();
86 if (x == null) {
87 x = new JSONObject();
88 setAllowedCharacters(x);
89 }
90 x.put(key, value);
91 return this;
92 }
93
94
95
96
97
98 public EditorUnicodeHighlightOptions setAllowedCharacters(final java.util.Map<String, Boolean> allowedCharacters) {
99 return setAllowedCharacters(new JSONObject(allowedCharacters));
100 }
101
102
103
104
105 public JSONObject getAllowedLocales() {
106 return (JSONObject) (has("allowedLocales") ? get("allowedLocales") : null);
107 }
108
109
110
111
112
113
114 public EditorUnicodeHighlightOptions setAllowedLocales(final JSONObject allowedLocales) {
115 put("allowedLocales", allowedLocales);
116 return this;
117 }
118
119
120
121
122
123
124
125 public EditorUnicodeHighlightOptions addAllowedLocale(final String key, final Boolean value) {
126 JSONObject x = getAllowedLocales();
127 if (x == null) {
128 x = new JSONObject();
129 setAllowedLocales(x);
130 }
131 x.put(key, value);
132 return this;
133 }
134
135
136
137
138
139
140 public EditorUnicodeHighlightOptions setAllowedLocales(final java.util.Map<String, Boolean> allowedLocales) {
141 return setAllowedLocales(new JSONObject(allowedLocales));
142 }
143
144
145
146
147
148 public Boolean isAmbiguousCharacters() {
149 return (Boolean) (has("ambiguousCharacters") ? get("ambiguousCharacters") : null);
150 }
151
152
153
154
155
156
157 public EditorUnicodeHighlightOptions setAmbiguousCharacters(final Boolean ambiguousCharacters) {
158 put("ambiguousCharacters", ambiguousCharacters);
159 return this;
160 }
161
162 public Boolean isIncludeComments() {
163 final Object tmp = (has("includeComments") ? get("includeComments") : null);
164 return (Boolean) (tmp instanceof Boolean ? tmp : null);
165 }
166
167 public String getIncludeComments() {
168 final Object tmp = (has("includeComments") ? get("includeComments") : null);
169 return (String) (tmp instanceof String ? tmp : null);
170 }
171
172 public EditorUnicodeHighlightOptions setIncludeComments(final Boolean includeComments) {
173 put("includeComments", includeComments);
174 return this;
175 }
176
177 public EditorUnicodeHighlightOptions setIncludeComments(final String includeComments) {
178 put("includeComments", includeComments);
179 return this;
180 }
181
182 public Boolean isIncludeStrings() {
183 final Object tmp = (has("includeStrings") ? get("includeStrings") : null);
184 return (Boolean) (tmp instanceof Boolean ? tmp : null);
185 }
186
187 public String getIncludeStrings() {
188 final Object tmp = (has("includeStrings") ? get("includeStrings") : null);
189 return (String) (tmp instanceof String ? tmp : null);
190 }
191
192 public EditorUnicodeHighlightOptions setIncludeStrings(final Boolean includeStrings) {
193 put("includeStrings", includeStrings);
194 return this;
195 }
196
197 public EditorUnicodeHighlightOptions setIncludeStrings(final String includeStrings) {
198 put("includeStrings", includeStrings);
199 return this;
200 }
201
202
203
204
205 public Boolean isInvisibleCharacters() {
206 return (Boolean) (has("invisibleCharacters") ? get("invisibleCharacters") : null);
207 }
208
209
210
211
212
213
214 public EditorUnicodeHighlightOptions setInvisibleCharacters(final Boolean invisibleCharacters) {
215 put("invisibleCharacters", invisibleCharacters);
216 return this;
217 }
218
219 public Boolean isNonBasicASCII() {
220 final Object tmp = (has("nonBasicASCII") ? get("nonBasicASCII") : null);
221 return (Boolean) (tmp instanceof Boolean ? tmp : null);
222 }
223
224 public String getNonBasicASCII() {
225 final Object tmp = (has("nonBasicASCII") ? get("nonBasicASCII") : null);
226 return (String) (tmp instanceof String ? tmp : null);
227 }
228
229 public EditorUnicodeHighlightOptions setNonBasicASCII(final Boolean nonBasicASCII) {
230 put("nonBasicASCII", nonBasicASCII);
231 return this;
232 }
233
234 public EditorUnicodeHighlightOptions setNonBasicASCII(final String nonBasicASCII) {
235 put("nonBasicASCII", nonBasicASCII);
236 return this;
237 }
238
239
240
241
242 JSONObject getJSONObject() {
243 return this;
244 }
245 }