use of io.vertx.core.json.JsonArray in project vert.x by eclipse.
the class OptionConverter method toJson.
public static void toJson(Option obj, JsonObject json) {
if (obj.getArgName() != null) {
json.put("argName", obj.getArgName());
}
if (obj.getChoices() != null) {
JsonArray array = new JsonArray();
obj.getChoices().forEach(item -> array.add(item));
json.put("choices", array);
}
if (obj.getDefaultValue() != null) {
json.put("defaultValue", obj.getDefaultValue());
}
if (obj.getDescription() != null) {
json.put("description", obj.getDescription());
}
json.put("flag", obj.isFlag());
json.put("help", obj.isHelp());
json.put("hidden", obj.isHidden());
if (obj.getLongName() != null) {
json.put("longName", obj.getLongName());
}
json.put("multiValued", obj.isMultiValued());
if (obj.getName() != null) {
json.put("name", obj.getName());
}
json.put("required", obj.isRequired());
if (obj.getShortName() != null) {
json.put("shortName", obj.getShortName());
}
json.put("singleValued", obj.isSingleValued());
}
use of io.vertx.core.json.JsonArray in project vert.x by eclipse.
the class HttpClientOptionsConverter method toJson.
public static void toJson(HttpClientOptions obj, JsonObject json) {
if (obj.getAlpnVersions() != null) {
JsonArray array = new JsonArray();
obj.getAlpnVersions().forEach(item -> array.add(item.name()));
json.put("alpnVersions", array);
}
if (obj.getDefaultHost() != null) {
json.put("defaultHost", obj.getDefaultHost());
}
json.put("defaultPort", obj.getDefaultPort());
json.put("http2ClearTextUpgrade", obj.isHttp2ClearTextUpgrade());
json.put("http2ConnectionWindowSize", obj.getHttp2ConnectionWindowSize());
json.put("http2MaxPoolSize", obj.getHttp2MaxPoolSize());
json.put("http2MultiplexingLimit", obj.getHttp2MultiplexingLimit());
if (obj.getInitialSettings() != null) {
json.put("initialSettings", obj.getInitialSettings().toJson());
}
json.put("keepAlive", obj.isKeepAlive());
json.put("maxChunkSize", obj.getMaxChunkSize());
json.put("maxHeaderSize", obj.getMaxHeaderSize());
json.put("maxInitialLineLength", obj.getMaxInitialLineLength());
json.put("maxPoolSize", obj.getMaxPoolSize());
json.put("maxRedirects", obj.getMaxRedirects());
json.put("maxWaitQueueSize", obj.getMaxWaitQueueSize());
json.put("maxWebsocketFrameSize", obj.getMaxWebsocketFrameSize());
json.put("maxWebsocketMessageSize", obj.getMaxWebsocketMessageSize());
json.put("pipelining", obj.isPipelining());
json.put("pipeliningLimit", obj.getPipeliningLimit());
if (obj.getProtocolVersion() != null) {
json.put("protocolVersion", obj.getProtocolVersion().name());
}
json.put("sendUnmaskedFrames", obj.isSendUnmaskedFrames());
json.put("tryUseCompression", obj.isTryUseCompression());
json.put("verifyHost", obj.isVerifyHost());
}
use of io.vertx.core.json.JsonArray in project vert.x by eclipse.
the class DataObjectTest method testJsonToDataObject.
@Test
public void testJsonToDataObject() {
String key = TestUtils.randomAlphaString(10);
String stringValue = TestUtils.randomAlphaString(20);
boolean booleanValue = TestUtils.randomBoolean();
byte byteValue = TestUtils.randomByte();
short shortValue = TestUtils.randomShort();
int intValue = TestUtils.randomInt();
long longValue = TestUtils.randomLong();
float floatValue = TestUtils.randomFloat();
double doubleValue = TestUtils.randomDouble();
char charValue = TestUtils.randomChar();
Boolean boxedBooleanValue = TestUtils.randomBoolean();
Byte boxedByteValue = TestUtils.randomByte();
Short boxedShortValue = TestUtils.randomShort();
Integer boxedIntValue = TestUtils.randomInt();
Long boxedLongValue = TestUtils.randomLong();
Float boxedFloatValue = TestUtils.randomFloat();
Double boxedDoubleValue = TestUtils.randomDouble();
Character boxedCharValue = TestUtils.randomChar();
AggregatedDataObject aggregatedDataObject = new AggregatedDataObject().setValue(TestUtils.randomAlphaString(20));
Buffer buffer = TestUtils.randomBuffer(20);
JsonObject jsonObject = new JsonObject().put("wibble", TestUtils.randomAlphaString(20));
JsonArray jsonArray = new JsonArray().add(TestUtils.randomAlphaString(20));
HttpMethod httpMethod = HttpMethod.values()[TestUtils.randomPositiveInt() % HttpMethod.values().length];
Map<String, Object> map = new HashMap<>();
map.put(TestUtils.randomAlphaString(10), TestUtils.randomAlphaString(20));
map.put(TestUtils.randomAlphaString(10), TestUtils.randomBoolean());
map.put(TestUtils.randomAlphaString(10), TestUtils.randomInt());
List<Object> list = new ArrayList<>();
list.add(TestUtils.randomAlphaString(20));
list.add(TestUtils.randomBoolean());
list.add(TestUtils.randomInt());
JsonObject json = new JsonObject();
json.put("stringValue", stringValue);
json.put("booleanValue", booleanValue);
json.put("byteValue", byteValue);
json.put("shortValue", shortValue);
json.put("intValue", intValue);
json.put("longValue", longValue);
json.put("floatValue", floatValue);
json.put("doubleValue", doubleValue);
json.put("charValue", Character.toString(charValue));
json.put("boxedBooleanValue", boxedBooleanValue);
json.put("boxedByteValue", boxedByteValue);
json.put("boxedShortValue", boxedShortValue);
json.put("boxedIntValue", boxedIntValue);
json.put("boxedLongValue", boxedLongValue);
json.put("boxedFloatValue", boxedFloatValue);
json.put("boxedDoubleValue", boxedDoubleValue);
json.put("boxedCharValue", Character.toString(boxedCharValue));
json.put("aggregatedDataObject", aggregatedDataObject.toJson());
json.put("buffer", toBase64(buffer));
json.put("jsonObject", jsonObject);
json.put("jsonArray", jsonArray);
json.put("httpMethod", httpMethod.toString());
json.put("stringValues", new JsonArray().add(stringValue));
json.put("boxedBooleanValues", new JsonArray().add(boxedBooleanValue));
json.put("boxedByteValues", new JsonArray().add(boxedByteValue));
json.put("boxedShortValues", new JsonArray().add(boxedShortValue));
json.put("boxedIntValues", new JsonArray().add(boxedIntValue));
json.put("boxedLongValues", new JsonArray().add(boxedLongValue));
json.put("boxedFloatValues", new JsonArray().add(boxedFloatValue));
json.put("boxedDoubleValues", new JsonArray().add(boxedDoubleValue));
json.put("boxedCharValues", new JsonArray().add(Character.toString(boxedCharValue)));
json.put("aggregatedDataObjects", new JsonArray().add(aggregatedDataObject.toJson()));
json.put("buffers", new JsonArray().add(toBase64(buffer)));
json.put("jsonObjects", new JsonArray().add(jsonObject));
json.put("jsonArrays", new JsonArray().add(jsonArray));
json.put("httpMethods", new JsonArray().add(httpMethod.toString()));
json.put("objects", new JsonArray().add(list.get(0)).add(list.get(1)).add(list.get(2)));
json.put("addedStringValues", new JsonArray().add(stringValue));
json.put("addedBooleanValues", new JsonArray().add(boxedBooleanValue));
json.put("addedByteValues", new JsonArray().add(boxedByteValue));
json.put("addedShortValues", new JsonArray().add(boxedShortValue));
json.put("addedIntValues", new JsonArray().add(boxedIntValue));
json.put("addedLongValues", new JsonArray().add(boxedLongValue));
json.put("addedFloatValues", new JsonArray().add(boxedFloatValue));
json.put("addedDoubleValues", new JsonArray().add(boxedDoubleValue));
json.put("addedCharValues", new JsonArray().add(Character.toString(boxedCharValue)));
json.put("addedBoxedBooleanValues", new JsonArray().add(boxedBooleanValue));
json.put("addedBoxedByteValues", new JsonArray().add(boxedByteValue));
json.put("addedBoxedShortValues", new JsonArray().add(boxedShortValue));
json.put("addedBoxedIntValues", new JsonArray().add(boxedIntValue));
json.put("addedBoxedLongValues", new JsonArray().add(boxedLongValue));
json.put("addedBoxedFloatValues", new JsonArray().add(boxedFloatValue));
json.put("addedBoxedDoubleValues", new JsonArray().add(boxedDoubleValue));
json.put("addedBoxedCharValues", new JsonArray().add(Character.toString(boxedCharValue)));
json.put("addedAggregatedDataObjects", new JsonArray().add(aggregatedDataObject.toJson()));
json.put("addedBuffers", new JsonArray().add(toBase64(buffer)));
json.put("addedJsonObjects", new JsonArray().add(jsonObject));
json.put("addedJsonArrays", new JsonArray().add(jsonArray));
json.put("addedHttpMethods", new JsonArray().add(httpMethod.toString()));
json.put("addedObjects", new JsonArray().add(list.get(0)).add(list.get(1)).add(list.get(2)));
json.put("stringValueMap", new JsonObject().put(key, stringValue));
json.put("boxedBooleanValueMap", new JsonObject().put(key, boxedBooleanValue));
json.put("boxedByteValueMap", new JsonObject().put(key, boxedByteValue));
json.put("boxedShortValueMap", new JsonObject().put(key, boxedShortValue));
json.put("boxedIntValueMap", new JsonObject().put(key, boxedIntValue));
json.put("boxedLongValueMap", new JsonObject().put(key, boxedLongValue));
json.put("boxedFloatValueMap", new JsonObject().put(key, boxedFloatValue));
json.put("boxedDoubleValueMap", new JsonObject().put(key, boxedDoubleValue));
json.put("boxedCharValueMap", new JsonObject().put(key, Character.toString(boxedCharValue)));
json.put("aggregatedDataObjectMap", new JsonObject().put(key, aggregatedDataObject.toJson()));
json.put("bufferMap", new JsonObject().put(key, toBase64(buffer)));
json.put("jsonObjectMap", new JsonObject().put(key, jsonObject));
json.put("jsonArrayMap", new JsonObject().put(key, jsonArray));
json.put("httpMethodMap", new JsonObject().put(key, httpMethod.toString()));
json.put("objectMap", toJson(map));
json.put("keyedStringValues", new JsonObject().put(key, stringValue));
json.put("keyedBoxedBooleanValues", new JsonObject().put(key, boxedBooleanValue));
json.put("keyedBoxedByteValues", new JsonObject().put(key, boxedByteValue));
json.put("keyedBoxedShortValues", new JsonObject().put(key, boxedShortValue));
json.put("keyedBoxedIntValues", new JsonObject().put(key, boxedIntValue));
json.put("keyedBoxedLongValues", new JsonObject().put(key, boxedLongValue));
json.put("keyedBoxedFloatValues", new JsonObject().put(key, boxedFloatValue));
json.put("keyedBoxedDoubleValues", new JsonObject().put(key, boxedDoubleValue));
json.put("keyedBoxedCharValues", new JsonObject().put(key, Character.toString(boxedCharValue)));
json.put("keyedDataObjectValues", new JsonObject().put(key, aggregatedDataObject.toJson()));
json.put("keyedBufferValues", new JsonObject().put(key, toBase64(buffer)));
json.put("keyedJsonObjectValues", new JsonObject().put(key, jsonObject));
json.put("keyedJsonArrayValues", new JsonObject().put(key, jsonArray));
json.put("keyedEnumValues", new JsonObject().put(key, httpMethod));
json.put("keyedObjectValues", toJson(map));
TestDataObject obj = new TestDataObject();
TestDataObjectConverter.fromJson(json, obj);
assertEquals(stringValue, obj.getStringValue());
assertEquals(booleanValue, obj.isBooleanValue());
assertEquals(byteValue, obj.getByteValue());
assertEquals(shortValue, obj.getShortValue());
assertEquals(intValue, obj.getIntValue());
assertEquals(longValue, obj.getLongValue());
assertEquals(floatValue, obj.getFloatValue(), 0);
assertEquals(doubleValue, obj.getDoubleValue(), 0);
assertEquals(charValue, obj.getCharValue());
assertEquals(boxedBooleanValue, obj.isBoxedBooleanValue());
assertEquals(boxedByteValue, obj.getBoxedByteValue());
assertEquals(boxedShortValue, obj.getBoxedShortValue());
assertEquals(boxedIntValue, obj.getBoxedIntValue());
assertEquals(boxedLongValue, obj.getBoxedLongValue());
assertEquals(boxedFloatValue, obj.getBoxedFloatValue(), 0);
assertEquals(boxedDoubleValue, obj.getBoxedDoubleValue(), 0);
assertEquals(boxedCharValue, obj.getBoxedCharValue());
assertEquals(aggregatedDataObject, obj.getAggregatedDataObject());
assertEquals(buffer, obj.getBuffer());
assertEquals(jsonObject, obj.getJsonObject());
assertEquals(jsonArray, obj.getJsonArray());
assertEquals(httpMethod, obj.getHttpMethod());
assertEquals(Collections.singletonList(stringValue), obj.getStringValues());
assertEquals(Collections.singletonList(boxedBooleanValue), obj.getBoxedBooleanValues());
assertEquals(Collections.singletonList(boxedByteValue), obj.getBoxedByteValues());
assertEquals(Collections.singletonList(boxedShortValue), obj.getBoxedShortValues());
assertEquals(Collections.singletonList(boxedIntValue), obj.getBoxedIntValues());
assertEquals(Collections.singletonList(boxedLongValue), obj.getBoxedLongValues());
assertEquals(Collections.singletonList(boxedFloatValue), obj.getBoxedFloatValues());
assertEquals(Collections.singletonList(boxedDoubleValue), obj.getBoxedDoubleValues());
assertEquals(Collections.singletonList(boxedCharValue), obj.getBoxedCharValues());
assertEquals(Collections.singletonList(aggregatedDataObject), obj.getAggregatedDataObjects());
assertEquals(Collections.singletonList(buffer), obj.getBuffers());
assertEquals(Collections.singletonList(jsonObject), obj.getJsonObjects());
assertEquals(Collections.singletonList(jsonArray), obj.getJsonArrays());
assertEquals(Collections.singletonList(httpMethod), obj.getHttpMethods());
assertEquals(list, obj.getObjects());
assertEquals(Collections.singletonList(stringValue), obj.getAddedStringValues());
assertEquals(Collections.singletonList(boxedBooleanValue), obj.getAddedBoxedBooleanValues());
assertEquals(Collections.singletonList(boxedByteValue), obj.getAddedBoxedByteValues());
assertEquals(Collections.singletonList(boxedShortValue), obj.getAddedBoxedShortValues());
assertEquals(Collections.singletonList(boxedIntValue), obj.getAddedBoxedIntValues());
assertEquals(Collections.singletonList(boxedLongValue), obj.getAddedBoxedLongValues());
assertEquals(Collections.singletonList(boxedFloatValue), obj.getAddedBoxedFloatValues());
assertEquals(Collections.singletonList(boxedDoubleValue), obj.getAddedBoxedDoubleValues());
assertEquals(Collections.singletonList(boxedCharValue), obj.getAddedBoxedCharValues());
assertEquals(Collections.singletonList(aggregatedDataObject), obj.getAddedAggregatedDataObjects());
assertEquals(Collections.singletonList(buffer), obj.getAddedBuffers());
assertEquals(Collections.singletonList(jsonObject), obj.getAddedJsonObjects());
assertEquals(Collections.singletonList(jsonArray), obj.getAddedJsonArrays());
assertEquals(Collections.singletonList(httpMethod), obj.getAddedHttpMethods());
assertEquals(list, obj.getAddedObjects());
assertEquals(Collections.singletonMap(key, stringValue), obj.getStringValueMap());
assertEquals(Collections.singletonMap(key, boxedBooleanValue), obj.getBoxedBooleanValueMap());
assertEquals(Collections.singletonMap(key, boxedByteValue), obj.getBoxedByteValueMap());
assertEquals(Collections.singletonMap(key, boxedShortValue), obj.getBoxedShortValueMap());
assertEquals(Collections.singletonMap(key, boxedIntValue), obj.getBoxedIntValueMap());
assertEquals(Collections.singletonMap(key, boxedLongValue), obj.getBoxedLongValueMap());
assertEquals(Collections.singletonMap(key, boxedFloatValue), obj.getBoxedFloatValueMap());
assertEquals(Collections.singletonMap(key, boxedDoubleValue), obj.getBoxedDoubleValueMap());
assertEquals(Collections.singletonMap(key, boxedCharValue), obj.getBoxedCharValueMap());
assertEquals(Collections.singletonMap(key, aggregatedDataObject), obj.getAggregatedDataObjectMap());
assertEquals(Collections.singletonMap(key, buffer), obj.getBufferMap());
assertEquals(Collections.singletonMap(key, jsonObject), obj.getJsonObjectMap());
assertEquals(Collections.singletonMap(key, jsonArray), obj.getJsonArrayMap());
assertEquals(Collections.singletonMap(key, httpMethod), obj.getHttpMethodMap());
assertEquals(map, obj.getObjectMap());
assertEquals(Collections.singletonMap(key, stringValue), obj.getKeyedStringValues());
assertEquals(Collections.singletonMap(key, boxedBooleanValue), obj.getKeyedBoxedBooleanValues());
assertEquals(Collections.singletonMap(key, boxedByteValue), obj.getKeyedBoxedByteValues());
assertEquals(Collections.singletonMap(key, boxedShortValue), obj.getKeyedBoxedShortValues());
assertEquals(Collections.singletonMap(key, boxedIntValue), obj.getKeyedBoxedIntValues());
assertEquals(Collections.singletonMap(key, boxedLongValue), obj.getKeyedBoxedLongValues());
assertEquals(Collections.singletonMap(key, boxedFloatValue), obj.getKeyedBoxedFloatValues());
assertEquals(Collections.singletonMap(key, boxedDoubleValue), obj.getKeyedBoxedDoubleValues());
assertEquals(Collections.singletonMap(key, boxedCharValue), obj.getKeyedBoxedCharValues());
assertEquals(Collections.singletonMap(key, aggregatedDataObject), obj.getKeyedDataObjectValues());
assertEquals(Collections.singletonMap(key, buffer), obj.getKeyedBufferValues());
assertEquals(Collections.singletonMap(key, jsonObject), obj.getKeyedJsonObjectValues());
assertEquals(Collections.singletonMap(key, jsonArray), obj.getKeyedJsonArrayValues());
assertEquals(Collections.singletonMap(key, httpMethod), obj.getKeyedEnumValues());
assertEquals(map, obj.getObjectMap());
// Sometimes json can use java collections so test it runs fine in this case
json = new JsonObject();
json.put("aggregatedDataObject", new JsonObject().put("value", aggregatedDataObject.getValue()).getMap());
json.put("aggregatedDataObjects", new JsonArray().add(new JsonObject().put("value", aggregatedDataObject.getValue()).getMap()));
json.put("addedAggregatedDataObjects", new JsonArray().add(new JsonObject().put("value", aggregatedDataObject.getValue()).getMap()));
obj = new TestDataObject();
TestDataObjectConverter.fromJson(json, obj);
assertEquals(aggregatedDataObject, obj.getAggregatedDataObject());
assertEquals(Collections.singletonList(aggregatedDataObject), obj.getAggregatedDataObjects());
assertEquals(Collections.singletonList(aggregatedDataObject), obj.getAddedAggregatedDataObjects());
}
use of io.vertx.core.json.JsonArray in project vert.x by eclipse.
the class BufferTest method testToJsonArray.
@Test
public void testToJsonArray() throws Exception {
JsonArray arr = new JsonArray();
arr.add("wibble");
arr.add(5);
arr.add(true);
Buffer buff = Buffer.buffer(arr.encode());
assertEquals(arr, buff.toJsonArray());
buff = Buffer.buffer(TestUtils.randomAlphaString(10));
try {
buff.toJsonObject();
fail();
} catch (DecodeException ignore) {
}
}
use of io.vertx.core.json.JsonArray in project vert.x by eclipse.
the class TestDataObjectConverter method toJson.
public static void toJson(TestDataObject obj, JsonObject json) {
if (obj.getAddedAggregatedDataObjects() != null) {
JsonArray array = new JsonArray();
obj.getAddedAggregatedDataObjects().forEach(item -> array.add(item.toJson()));
json.put("addedAggregatedDataObjects", array);
}
if (obj.getAddedBoxedBooleanValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedBooleanValues().forEach(item -> array.add(item));
json.put("addedBoxedBooleanValues", array);
}
if (obj.getAddedBoxedByteValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedByteValues().forEach(item -> array.add(item));
json.put("addedBoxedByteValues", array);
}
if (obj.getAddedBoxedCharValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedCharValues().forEach(item -> array.add(Character.toString(item)));
json.put("addedBoxedCharValues", array);
}
if (obj.getAddedBoxedDoubleValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedDoubleValues().forEach(item -> array.add(item));
json.put("addedBoxedDoubleValues", array);
}
if (obj.getAddedBoxedFloatValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedFloatValues().forEach(item -> array.add(item));
json.put("addedBoxedFloatValues", array);
}
if (obj.getAddedBoxedIntValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedIntValues().forEach(item -> array.add(item));
json.put("addedBoxedIntValues", array);
}
if (obj.getAddedBoxedLongValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedLongValues().forEach(item -> array.add(item));
json.put("addedBoxedLongValues", array);
}
if (obj.getAddedBoxedShortValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedBoxedShortValues().forEach(item -> array.add(item));
json.put("addedBoxedShortValues", array);
}
if (obj.getAddedBuffers() != null) {
JsonArray array = new JsonArray();
obj.getAddedBuffers().forEach(item -> array.add(item.getBytes()));
json.put("addedBuffers", array);
}
if (obj.getAddedHttpMethods() != null) {
JsonArray array = new JsonArray();
obj.getAddedHttpMethods().forEach(item -> array.add(item.name()));
json.put("addedHttpMethods", array);
}
if (obj.getAddedJsonArrays() != null) {
JsonArray array = new JsonArray();
obj.getAddedJsonArrays().forEach(item -> array.add(item));
json.put("addedJsonArrays", array);
}
if (obj.getAddedJsonObjects() != null) {
JsonArray array = new JsonArray();
obj.getAddedJsonObjects().forEach(item -> array.add(item));
json.put("addedJsonObjects", array);
}
if (obj.getAddedObjects() != null) {
JsonArray array = new JsonArray();
obj.getAddedObjects().forEach(item -> array.add(item));
json.put("addedObjects", array);
}
if (obj.getAddedStringValues() != null) {
JsonArray array = new JsonArray();
obj.getAddedStringValues().forEach(item -> array.add(item));
json.put("addedStringValues", array);
}
if (obj.getAggregatedDataObject() != null) {
json.put("aggregatedDataObject", obj.getAggregatedDataObject().toJson());
}
if (obj.getAggregatedDataObjectMap() != null) {
JsonObject map = new JsonObject();
obj.getAggregatedDataObjectMap().forEach((key, value) -> map.put(key, value.toJson()));
json.put("aggregatedDataObjectMap", map);
}
if (obj.getAggregatedDataObjects() != null) {
JsonArray array = new JsonArray();
obj.getAggregatedDataObjects().forEach(item -> array.add(item.toJson()));
json.put("aggregatedDataObjects", array);
}
json.put("booleanValue", obj.isBooleanValue());
if (obj.isBoxedBooleanValue() != null) {
json.put("boxedBooleanValue", obj.isBoxedBooleanValue());
}
if (obj.getBoxedBooleanValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedBooleanValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedBooleanValueMap", map);
}
if (obj.getBoxedBooleanValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedBooleanValues().forEach(item -> array.add(item));
json.put("boxedBooleanValues", array);
}
if (obj.getBoxedByteValue() != null) {
json.put("boxedByteValue", obj.getBoxedByteValue());
}
if (obj.getBoxedByteValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedByteValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedByteValueMap", map);
}
if (obj.getBoxedByteValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedByteValues().forEach(item -> array.add(item));
json.put("boxedByteValues", array);
}
if (obj.getBoxedCharValue() != null) {
json.put("boxedCharValue", Character.toString(obj.getBoxedCharValue()));
}
if (obj.getBoxedCharValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedCharValueMap().forEach((key, value) -> map.put(key, Character.toString(value)));
json.put("boxedCharValueMap", map);
}
if (obj.getBoxedCharValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedCharValues().forEach(item -> array.add(Character.toString(item)));
json.put("boxedCharValues", array);
}
if (obj.getBoxedDoubleValue() != null) {
json.put("boxedDoubleValue", obj.getBoxedDoubleValue());
}
if (obj.getBoxedDoubleValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedDoubleValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedDoubleValueMap", map);
}
if (obj.getBoxedDoubleValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedDoubleValues().forEach(item -> array.add(item));
json.put("boxedDoubleValues", array);
}
if (obj.getBoxedFloatValue() != null) {
json.put("boxedFloatValue", obj.getBoxedFloatValue());
}
if (obj.getBoxedFloatValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedFloatValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedFloatValueMap", map);
}
if (obj.getBoxedFloatValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedFloatValues().forEach(item -> array.add(item));
json.put("boxedFloatValues", array);
}
if (obj.getBoxedIntValue() != null) {
json.put("boxedIntValue", obj.getBoxedIntValue());
}
if (obj.getBoxedIntValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedIntValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedIntValueMap", map);
}
if (obj.getBoxedIntValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedIntValues().forEach(item -> array.add(item));
json.put("boxedIntValues", array);
}
if (obj.getBoxedLongValue() != null) {
json.put("boxedLongValue", obj.getBoxedLongValue());
}
if (obj.getBoxedLongValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedLongValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedLongValueMap", map);
}
if (obj.getBoxedLongValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedLongValues().forEach(item -> array.add(item));
json.put("boxedLongValues", array);
}
if (obj.getBoxedShortValue() != null) {
json.put("boxedShortValue", obj.getBoxedShortValue());
}
if (obj.getBoxedShortValueMap() != null) {
JsonObject map = new JsonObject();
obj.getBoxedShortValueMap().forEach((key, value) -> map.put(key, value));
json.put("boxedShortValueMap", map);
}
if (obj.getBoxedShortValues() != null) {
JsonArray array = new JsonArray();
obj.getBoxedShortValues().forEach(item -> array.add(item));
json.put("boxedShortValues", array);
}
if (obj.getBuffer() != null) {
json.put("buffer", obj.getBuffer().getBytes());
}
if (obj.getBufferMap() != null) {
JsonObject map = new JsonObject();
obj.getBufferMap().forEach((key, value) -> map.put(key, value.getBytes()));
json.put("bufferMap", map);
}
if (obj.getBuffers() != null) {
JsonArray array = new JsonArray();
obj.getBuffers().forEach(item -> array.add(item.getBytes()));
json.put("buffers", array);
}
json.put("byteValue", obj.getByteValue());
json.put("charValue", Character.toString(obj.getCharValue()));
json.put("doubleValue", obj.getDoubleValue());
json.put("floatValue", obj.getFloatValue());
if (obj.getHttpMethod() != null) {
json.put("httpMethod", obj.getHttpMethod().name());
}
if (obj.getHttpMethodMap() != null) {
JsonObject map = new JsonObject();
obj.getHttpMethodMap().forEach((key, value) -> map.put(key, value.name()));
json.put("httpMethodMap", map);
}
if (obj.getHttpMethods() != null) {
JsonArray array = new JsonArray();
obj.getHttpMethods().forEach(item -> array.add(item.name()));
json.put("httpMethods", array);
}
json.put("intValue", obj.getIntValue());
if (obj.getJsonArray() != null) {
json.put("jsonArray", obj.getJsonArray());
}
if (obj.getJsonArrayMap() != null) {
JsonObject map = new JsonObject();
obj.getJsonArrayMap().forEach((key, value) -> map.put(key, value));
json.put("jsonArrayMap", map);
}
if (obj.getJsonArrays() != null) {
JsonArray array = new JsonArray();
obj.getJsonArrays().forEach(item -> array.add(item));
json.put("jsonArrays", array);
}
if (obj.getJsonObject() != null) {
json.put("jsonObject", obj.getJsonObject());
}
if (obj.getJsonObjectMap() != null) {
JsonObject map = new JsonObject();
obj.getJsonObjectMap().forEach((key, value) -> map.put(key, value));
json.put("jsonObjectMap", map);
}
if (obj.getJsonObjects() != null) {
JsonArray array = new JsonArray();
obj.getJsonObjects().forEach(item -> array.add(item));
json.put("jsonObjects", array);
}
if (obj.getKeyedBoxedBooleanValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedBooleanValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedBooleanValues", map);
}
if (obj.getKeyedBoxedByteValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedByteValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedByteValues", map);
}
if (obj.getKeyedBoxedCharValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedCharValues().forEach((key, value) -> map.put(key, Character.toString(value)));
json.put("keyedBoxedCharValues", map);
}
if (obj.getKeyedBoxedDoubleValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedDoubleValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedDoubleValues", map);
}
if (obj.getKeyedBoxedFloatValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedFloatValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedFloatValues", map);
}
if (obj.getKeyedBoxedIntValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedIntValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedIntValues", map);
}
if (obj.getKeyedBoxedLongValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedLongValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedLongValues", map);
}
if (obj.getKeyedBoxedShortValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBoxedShortValues().forEach((key, value) -> map.put(key, value));
json.put("keyedBoxedShortValues", map);
}
if (obj.getKeyedBufferValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedBufferValues().forEach((key, value) -> map.put(key, value.getBytes()));
json.put("keyedBufferValues", map);
}
if (obj.getKeyedDataObjectValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedDataObjectValues().forEach((key, value) -> map.put(key, value.toJson()));
json.put("keyedDataObjectValues", map);
}
if (obj.getKeyedEnumValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedEnumValues().forEach((key, value) -> map.put(key, value.name()));
json.put("keyedEnumValues", map);
}
if (obj.getKeyedJsonArrayValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedJsonArrayValues().forEach((key, value) -> map.put(key, value));
json.put("keyedJsonArrayValues", map);
}
if (obj.getKeyedJsonObjectValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedJsonObjectValues().forEach((key, value) -> map.put(key, value));
json.put("keyedJsonObjectValues", map);
}
if (obj.getKeyedObjectValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedObjectValues().forEach((key, value) -> map.put(key, value));
json.put("keyedObjectValues", map);
}
if (obj.getKeyedStringValues() != null) {
JsonObject map = new JsonObject();
obj.getKeyedStringValues().forEach((key, value) -> map.put(key, value));
json.put("keyedStringValues", map);
}
json.put("longValue", obj.getLongValue());
if (obj.getObjectMap() != null) {
JsonObject map = new JsonObject();
obj.getObjectMap().forEach((key, value) -> map.put(key, value));
json.put("objectMap", map);
}
if (obj.getObjects() != null) {
JsonArray array = new JsonArray();
obj.getObjects().forEach(item -> array.add(item));
json.put("objects", array);
}
json.put("shortValue", obj.getShortValue());
if (obj.getStringValue() != null) {
json.put("stringValue", obj.getStringValue());
}
if (obj.getStringValueMap() != null) {
JsonObject map = new JsonObject();
obj.getStringValueMap().forEach((key, value) -> map.put(key, value));
json.put("stringValueMap", map);
}
if (obj.getStringValues() != null) {
JsonArray array = new JsonArray();
obj.getStringValues().forEach(item -> array.add(item));
json.put("stringValues", array);
}
}
Aggregations