View Javadoc
1   
2   /*
3    * Copyright (c) 2011-2022 PrimeFaces Extensions
4    *
5    *  Permission is hereby granted, free of charge, to any person obtaining a copy
6    *  of this software and associated documentation files (the "Software"), to deal
7    *  in the Software without restriction, including without limitation the rights
8    *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9    *  copies of the Software, and to permit persons to whom the Software is
10   *  furnished to do so, subject to the following conditions:
11   *
12   *  The above copyright notice and this permission notice shall be included in
13   *  all copies or substantial portions of the Software.
14   *
15   *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16   *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17   *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18   *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19   *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20   *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21   *  THE SOFTWARE.
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  // THIS FILE WAS GENERATED AUTOMATICALLY. DO NOT EDIT DIRECTLY.
32  // ============================================================
33  
34  /**
35   * Controls the behavior of the unicode highlight feature (by default, ambiguous and invisible characters are
36   * highlighted).
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       * @return A map of allowed characters ({@code true}: allowed).
64       */
65      public JSONObject getAllowedCharacters() {
66          return (JSONObject) (has("allowedCharacters") ? get("allowedCharacters") : null);
67      }
68  
69      /**
70       * @param allowedCharacters A map of allowed characters ({@code true}: allowed).
71       * @return This same instance, useful for chaining multiple setter methods in one call.
72       */
73      public EditorUnicodeHighlightOptions setAllowedCharacters(final JSONObject allowedCharacters) {
74          put("allowedCharacters", allowedCharacters);
75          return this;
76      }
77  
78      /**
79       * A map of allowed characters ({@code true}: allowed).
80       * @param key The key of the map entry to add.
81       * @param value The value to associate with the key.
82       * @return This same instance, useful for chaining multiple setter methods in one call.
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       * @param allowedCharacters A map of allowed characters ({@code true}: allowed).
96       * @return This same instance, useful for chaining multiple setter methods in one call.
97       */
98      public EditorUnicodeHighlightOptions setAllowedCharacters(final java.util.Map<String, Boolean> allowedCharacters) {
99          return setAllowedCharacters(new JSONObject(allowedCharacters));
100     }
101 
102     /**
103      * @return Unicode characters that are common in allowed locales are not being highlighted. ({@code true}: allowed).
104      */
105     public JSONObject getAllowedLocales() {
106         return (JSONObject) (has("allowedLocales") ? get("allowedLocales") : null);
107     }
108 
109     /**
110      * @param allowedLocales Unicode characters that are common in allowed locales are not being highlighted. ({@code
111      * true}: allowed).
112      * @return This same instance, useful for chaining multiple setter methods in one call.
113      */
114     public EditorUnicodeHighlightOptions setAllowedLocales(final JSONObject allowedLocales) {
115         put("allowedLocales", allowedLocales);
116         return this;
117     }
118 
119     /**
120      * Unicode characters that are common in allowed locales are not being highlighted. ({@code true}: allowed).
121      * @param key The key of the map entry to add.
122      * @param value The value to associate with the key.
123      * @return This same instance, useful for chaining multiple setter methods in one call.
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      * @param allowedLocales Unicode characters that are common in allowed locales are not being highlighted. ({@code
137      * true}: allowed).
138      * @return This same instance, useful for chaining multiple setter methods in one call.
139      */
140     public EditorUnicodeHighlightOptions setAllowedLocales(final java.util.Map<String, Boolean> allowedLocales) {
141         return setAllowedLocales(new JSONObject(allowedLocales));
142     }
143 
144     /**
145      * @return Controls whether characters are highlighted that can be confused with basic ASCII characters, except
146      * those that are common in the current user locale.
147      */
148     public Boolean isAmbiguousCharacters() {
149         return (Boolean) (has("ambiguousCharacters") ? get("ambiguousCharacters") : null);
150     }
151 
152     /**
153      * @param ambiguousCharacters Controls whether characters are highlighted that can be confused with basic ASCII
154      * characters, except those that are common in the current user locale.
155      * @return This same instance, useful for chaining multiple setter methods in one call.
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      * @return Controls whether characters that just reserve space or have no width at all are highlighted.
204      */
205     public Boolean isInvisibleCharacters() {
206         return (Boolean) (has("invisibleCharacters") ? get("invisibleCharacters") : null);
207     }
208 
209     /**
210      * @param invisibleCharacters Controls whether characters that just reserve space or have no width at all are
211      * highlighted.
212      * @return This same instance, useful for chaining multiple setter methods in one call.
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      * @return This options object as a serializable JSON object
241      */
242     JSONObject getJSONObject() {
243         return this;
244     }
245 }