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 * Control the behavior and rendering of the inline hints. 36 */ 37 @SuppressWarnings("serial") 38 public class EditorInlayHintOptions extends JSONObject implements Serializable { 39 private Object writeReplace() throws ObjectStreamException { 40 return new SerializedEditorInlayHintOptions(this); 41 } 42 43 private static class SerializedEditorInlayHintOptions implements Serializable { 44 private String json; 45 46 public SerializedEditorInlayHintOptions(EditorInlayHintOptions editorInlayHintOptions) { 47 this.json = editorInlayHintOptions.toString(); 48 } 49 50 private Object readResolve() throws ObjectStreamException { 51 final EditorInlayHintOptions editorInlayHintOptions = new EditorInlayHintOptions(); 52 final JSONObject data = new JSONObject(json); 53 for (final String key : data.keySet()) { 54 final Object value = data.get(key); 55 editorInlayHintOptions.put(key, value); 56 } 57 return editorInlayHintOptions; 58 } 59 } 60 61 /** 62 * @return Enable the inline hints. Defaults to {@code on}. 63 */ 64 public String getEnabled() { 65 return (String) (has("enabled") ? get("enabled") : null); 66 } 67 68 /** 69 * @param enabled Enable the inline hints. Defaults to {@code on}. 70 * @return This same instance, useful for chaining multiple setter methods in one call. 71 */ 72 public EditorInlayHintOptions setEnabled(final EInlineSuggestMode enabled) { 73 put("enabled", enabled != null ? enabled.toString() : null); 74 return this; 75 } 76 77 /** 78 * @param enabled Enable the inline hints. Defaults to {@code on}. 79 * @return This same instance, useful for chaining multiple setter methods in one call. 80 */ 81 public EditorInlayHintOptions setEnabled(final String enabled) { 82 put("enabled", enabled); 83 return this; 84 } 85 86 /** 87 * @return Font family of inline hints. Defaults to editor font family. 88 */ 89 public String getFontFamily() { 90 return (String) (has("fontFamily") ? get("fontFamily") : null); 91 } 92 93 /** 94 * @param fontFamily Font family of inline hints. Defaults to editor font family. 95 * @return This same instance, useful for chaining multiple setter methods in one call. 96 */ 97 public EditorInlayHintOptions setFontFamily(final String fontFamily) { 98 put("fontFamily", fontFamily); 99 return this; 100 } 101 102 /** 103 * @return Font size of inline hints. Default to 90% of the editor font size. 104 */ 105 public Number getFontSize() { 106 return (Number) (has("fontSize") ? get("fontSize") : null); 107 } 108 109 /** 110 * @param fontSize Font size of inline hints. Default to 90% of the editor font size. 111 * @return This same instance, useful for chaining multiple setter methods in one call. 112 */ 113 public EditorInlayHintOptions setFontSize(final Number fontSize) { 114 put("fontSize", fontSize); 115 return this; 116 } 117 118 /** 119 * @return Enables the padding around the inlay hint. Defaults to {@code false}. 120 */ 121 public Boolean isPadding() { 122 return (Boolean) (has("padding") ? get("padding") : null); 123 } 124 125 /** 126 * @param padding Enables the padding around the inlay hint. Defaults to {@code false}. 127 * @return This same instance, useful for chaining multiple setter methods in one call. 128 */ 129 public EditorInlayHintOptions setPadding(final Boolean padding) { 130 put("padding", padding); 131 return this; 132 } 133 134 /** 135 * @return This options object as a serializable JSON object 136 */ 137 JSONObject getJSONObject() { 138 return this; 139 } 140 }