@Override public void onSuccess(LogAppenderDto key) { JSONObject json = (JSONObject) JSONParser.parseLenient(key.getJsonConfiguration()); json.put("minLogSchemaVersion", new JSONNumber(key.getMinLogSchemaVersion())); json.put("maxLogSchemaVersion", new JSONNumber(key.getMaxLogSchemaVersion())); json.put("pluginTypeName", new JSONString(key.getPluginTypeName())); json.put("pluginClassName", new JSONString(key.getPluginClassName())); JSONArray headersStructure = new JSONArray(); for (LogHeaderStructureDto header : key.getHeaderStructure()) { headersStructure.set(headersStructure.size(), new JSONString(header.getValue())); } json.put("headerStructure", headersStructure); ServletHelper.downloadJsonFile(json.toString(), key.getPluginTypeName() + ".json"); } };
@Override public JSONValue encode(Byte value) throws EncodingException { if (value == null) { return null; } return new JSONNumber(value); } };
public JSONValue get( Boolean object ) { return new JSONNumber( object ? 1 : 0 ); } }
public JSONValue get( Integer object ) { return new JSONNumber( object ); } }
@Override public JSONValue encode(Double value) throws EncodingException { return (value == null) ? getNullType() : new JSONNumber(value); } };
@Override public JSONValue encode(Long value) throws EncodingException { return (value == null) ? getNullType() : new JSONNumber(value); } };
@Override public JSONValue encode(Float value) throws EncodingException { return (value == null) ? getNullType() : new JSONNumber(value); } };
@Override public JSONValue encode(Character value) throws EncodingException { return (value == null) ? getNullType() : new JSONNumber(value); } };
public Attr fillOpacity( double fillOpacity ) { this.put( "fill-opacity", new JSONNumber( fillOpacity ) ); return this; }
public Attr strokeMiterLimit( double strokeMiterLimit ) { this.put( "stroke-miterlimit", new JSONNumber( strokeMiterLimit ) ); return this; }
@Override public JSONValue encode(Integer value) throws EncodingException { return (value == null) ? getNullType() : new JSONNumber(value); } };
@Override public JSONValue encode(Float value) throws EncodingException { return (value == null) ? getNullType() : new JSONNumber(value); } };
private static JavaScriptObject createReturnValue(TeXIcon icon, double ratio) { JSONObject object = new JSONObject(); object.put("width", new JSONNumber(icon.getIconWidth())); object.put("height", new JSONNumber(icon.getIconHeight())); object.put("baseline", new JSONNumber(icon.getBaseLine())); object.put("pixelRatio", new JSONNumber(ratio)); return object.getJavaScriptObject(); }
public final String toJSONString() { JSONObject object = new JSONObject(); object.put("x", new JSONNumber(getX())); object.put("y", new JSONNumber(getY())); object.put("width", new JSONNumber(getWidth())); object.put("height", new JSONNumber(getHeight())); return object.toString(); }
public static <Type> JSONValue toJSON(short[] value, AbstractJsonEncoderDecoder<Type> encoder) { if (value == null) { return getNullType(); } JSONArray rc = new JSONArray(); int i = 0; for (short t : value) { rc.set(i++, new JSONNumber(t)); } return rc; }
public static <Type> JSONValue toJSON(char[] value, AbstractJsonEncoderDecoder<Type> encoder) { if (value == null) { return getNullType(); } JSONArray rc = new JSONArray(); int i = 0; for (char t : value) { rc.set(i++, new JSONNumber(t)); } return rc; }
public static <Type> JSONValue toJSON(long[] value, AbstractJsonEncoderDecoder<Type> encoder) { if (value == null) { return getNullType(); } JSONArray rc = new JSONArray(); int i = 0; for (long t : value) { rc.set(i++, new JSONNumber(t)); } return rc; }
public static <Type> JSONValue toJSON(double[] value, AbstractJsonEncoderDecoder<Type> encoder) { if (value == null) { return getNullType(); } JSONArray rc = new JSONArray(); int i = 0; for (double t : value) { rc.set(i++, new JSONNumber(t)); } return rc; }
public static <Type> JSONValue toJSON(double[] value, AbstractJsonEncoderDecoder<Type> encoder) { if (value == null) { return getNullType(); } JSONArray rc = new JSONArray(); int i = 0; for (double t : value) { rc.set(i++, new JSONNumber(t)); } return rc; }
public static <Type> JSONValue toJSON(char[] value, AbstractJsonEncoderDecoder<Type> encoder) { if (value == null) { return getNullType(); } JSONArray rc = new JSONArray(); int i = 0; for (char t : value) { rc.set(i++, new JSONNumber(t)); } return rc; }