mirror of
https://github.com/jlengrand/vert.x.git
synced 2026-03-10 08:51:19 +00:00
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.DeploymentOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.DeploymentOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.DeploymentOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class DeploymentOptionsConverter {
|
||||
public class DeploymentOptionsConverter implements JsonCodec<DeploymentOptions, JsonObject> {
|
||||
|
||||
public static final DeploymentOptionsConverter INSTANCE = new DeploymentOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(DeploymentOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public DeploymentOptions decode(JsonObject value) { return (value != null) ? new DeploymentOptions(value) : null; }
|
||||
|
||||
@Override public Class<DeploymentOptions> getTargetClass() { return DeploymentOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, DeploymentOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,19 +4,28 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.VertxOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.VertxOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.VertxOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class VertxOptionsConverter {
|
||||
public class VertxOptionsConverter implements JsonCodec<VertxOptions, JsonObject> {
|
||||
|
||||
public static final VertxOptionsConverter INSTANCE = new VertxOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(VertxOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public VertxOptions decode(JsonObject value) { return (value != null) ? new VertxOptions(value) : null; }
|
||||
|
||||
@Override public Class<VertxOptions> getTargetClass() { return VertxOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, VertxOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
switch (member.getKey()) {
|
||||
case "addressResolverOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setAddressResolverOptions(new io.vertx.core.dns.AddressResolverOptions((JsonObject)member.getValue()));
|
||||
obj.setAddressResolverOptions(io.vertx.core.dns.AddressResolverOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "blockedThreadCheckInterval":
|
||||
@@ -66,7 +75,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "eventBusOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setEventBusOptions(new io.vertx.core.eventbus.EventBusOptions((JsonObject)member.getValue()));
|
||||
obj.setEventBusOptions(io.vertx.core.eventbus.EventBusOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "eventLoopPoolSize":
|
||||
@@ -76,7 +85,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "fileSystemOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setFileSystemOptions(new io.vertx.core.file.FileSystemOptions((JsonObject)member.getValue()));
|
||||
obj.setFileSystemOptions(io.vertx.core.file.FileSystemOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "haEnabled":
|
||||
@@ -116,7 +125,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "metricsOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setMetricsOptions(new io.vertx.core.metrics.MetricsOptions((JsonObject)member.getValue()));
|
||||
obj.setMetricsOptions(io.vertx.core.metrics.MetricsOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "preferNativeTransport":
|
||||
@@ -131,7 +140,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "tracingOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setTracingOptions(new io.vertx.core.tracing.TracingOptions((JsonObject)member.getValue()));
|
||||
obj.setTracingOptions(io.vertx.core.tracing.TracingOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "warningExceptionTime":
|
||||
@@ -159,7 +168,7 @@ import java.time.format.DateTimeFormatter;
|
||||
|
||||
static void toJson(VertxOptions obj, java.util.Map<String, Object> json) {
|
||||
if (obj.getAddressResolverOptions() != null) {
|
||||
json.put("addressResolverOptions", obj.getAddressResolverOptions().toJson());
|
||||
json.put("addressResolverOptions", io.vertx.core.dns.AddressResolverOptionsConverter.INSTANCE.encode(obj.getAddressResolverOptions()));
|
||||
}
|
||||
json.put("blockedThreadCheckInterval", obj.getBlockedThreadCheckInterval());
|
||||
if (obj.getBlockedThreadCheckIntervalUnit() != null) {
|
||||
@@ -177,11 +186,11 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("clusterPublicPort", obj.getClusterPublicPort());
|
||||
json.put("clustered", obj.isClustered());
|
||||
if (obj.getEventBusOptions() != null) {
|
||||
json.put("eventBusOptions", obj.getEventBusOptions().toJson());
|
||||
json.put("eventBusOptions", io.vertx.core.eventbus.EventBusOptionsConverter.INSTANCE.encode(obj.getEventBusOptions()));
|
||||
}
|
||||
json.put("eventLoopPoolSize", obj.getEventLoopPoolSize());
|
||||
if (obj.getFileSystemOptions() != null) {
|
||||
json.put("fileSystemOptions", obj.getFileSystemOptions().toJson());
|
||||
json.put("fileSystemOptions", io.vertx.core.file.FileSystemOptionsConverter.INSTANCE.encode(obj.getFileSystemOptions()));
|
||||
}
|
||||
json.put("haEnabled", obj.isHAEnabled());
|
||||
if (obj.getHAGroup() != null) {
|
||||
@@ -197,12 +206,12 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("maxWorkerExecuteTimeUnit", obj.getMaxWorkerExecuteTimeUnit().name());
|
||||
}
|
||||
if (obj.getMetricsOptions() != null) {
|
||||
json.put("metricsOptions", obj.getMetricsOptions().toJson());
|
||||
json.put("metricsOptions", io.vertx.core.metrics.MetricsOptionsConverter.INSTANCE.encode(obj.getMetricsOptions()));
|
||||
}
|
||||
json.put("preferNativeTransport", obj.getPreferNativeTransport());
|
||||
json.put("quorumSize", obj.getQuorumSize());
|
||||
if (obj.getTracingOptions() != null) {
|
||||
json.put("tracingOptions", obj.getTracingOptions().toJson());
|
||||
json.put("tracingOptions", io.vertx.core.tracing.TracingOptionsConverter.INSTANCE.encode(obj.getTracingOptions()));
|
||||
}
|
||||
json.put("warningExceptionTime", obj.getWarningExceptionTime());
|
||||
if (obj.getWarningExceptionTimeUnit() != null) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.cli.Argument}.
|
||||
* Converter and Codec for {@link io.vertx.core.cli.Argument}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.Argument} original class using Vert.x codegen.
|
||||
*/
|
||||
class ArgumentConverter {
|
||||
public class ArgumentConverter implements JsonCodec<Argument, JsonObject> {
|
||||
|
||||
public static final ArgumentConverter INSTANCE = new ArgumentConverter();
|
||||
|
||||
@Override public JsonObject encode(Argument value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public Argument decode(JsonObject value) { return (value != null) ? new Argument(value) : null; }
|
||||
|
||||
@Override public Class<Argument> getTargetClass() { return Argument.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, Argument obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.cli.Option}.
|
||||
* Converter and Codec for {@link io.vertx.core.cli.Option}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.cli.Option} original class using Vert.x codegen.
|
||||
*/
|
||||
class OptionConverter {
|
||||
public class OptionConverter implements JsonCodec<Option, JsonObject> {
|
||||
|
||||
public static final OptionConverter INSTANCE = new OptionConverter();
|
||||
|
||||
@Override public JsonObject encode(Option value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public Option decode(JsonObject value) { return (value != null) ? new Option(value) : null; }
|
||||
|
||||
@Override public Class<Option> getTargetClass() { return Option.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, Option obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.datagram.DatagramSocketOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.datagram.DatagramSocketOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.datagram.DatagramSocketOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class DatagramSocketOptionsConverter {
|
||||
public class DatagramSocketOptionsConverter implements JsonCodec<DatagramSocketOptions, JsonObject> {
|
||||
|
||||
public static final DatagramSocketOptionsConverter INSTANCE = new DatagramSocketOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(DatagramSocketOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public DatagramSocketOptions decode(JsonObject value) { return (value != null) ? new DatagramSocketOptions(value) : null; }
|
||||
|
||||
@Override public Class<DatagramSocketOptions> getTargetClass() { return DatagramSocketOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, DatagramSocketOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.dns.AddressResolverOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.dns.AddressResolverOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.dns.AddressResolverOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class AddressResolverOptionsConverter {
|
||||
public class AddressResolverOptionsConverter implements JsonCodec<AddressResolverOptions, JsonObject> {
|
||||
|
||||
public static final AddressResolverOptionsConverter INSTANCE = new AddressResolverOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(AddressResolverOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public AddressResolverOptions decode(JsonObject value) { return (value != null) ? new AddressResolverOptions(value) : null; }
|
||||
|
||||
@Override public Class<AddressResolverOptions> getTargetClass() { return AddressResolverOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, AddressResolverOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.dns.DnsClientOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.dns.DnsClientOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.dns.DnsClientOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
public class DnsClientOptionsConverter {
|
||||
public class DnsClientOptionsConverter implements JsonCodec<DnsClientOptions, JsonObject> {
|
||||
|
||||
public static final DnsClientOptionsConverter INSTANCE = new DnsClientOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(DnsClientOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public DnsClientOptions decode(JsonObject value) { return (value != null) ? new DnsClientOptions(value) : null; }
|
||||
|
||||
@Override public Class<DnsClientOptions> getTargetClass() { return DnsClientOptions.class; }
|
||||
|
||||
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, DnsClientOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.vertx.core.eventbus;
|
||||
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter and Codec for {@link io.vertx.core.eventbus.DeliveryOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.eventbus.DeliveryOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
public class DeliveryOptionsConverter implements JsonCodec<DeliveryOptions, JsonObject> {
|
||||
|
||||
public static final DeliveryOptionsConverter INSTANCE = new DeliveryOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(DeliveryOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public DeliveryOptions decode(JsonObject value) { return (value != null) ? new DeliveryOptions(value) : null; }
|
||||
|
||||
@Override public Class<DeliveryOptions> getTargetClass() { return DeliveryOptions.class; }
|
||||
}
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.eventbus.EventBusOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.eventbus.EventBusOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.eventbus.EventBusOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class EventBusOptionsConverter {
|
||||
public class EventBusOptionsConverter implements JsonCodec<EventBusOptions, JsonObject> {
|
||||
|
||||
public static final EventBusOptionsConverter INSTANCE = new EventBusOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(EventBusOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public EventBusOptions decode(JsonObject value) { return (value != null) ? new EventBusOptions(value) : null; }
|
||||
|
||||
@Override public Class<EventBusOptions> getTargetClass() { return EventBusOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, EventBusOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
@@ -105,12 +114,12 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "jdkSslEngineOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setJdkSslEngineOptions(new io.vertx.core.net.JdkSSLEngineOptions((JsonObject)member.getValue()));
|
||||
obj.setJdkSslEngineOptions(io.vertx.core.net.JdkSSLEngineOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "keyStoreOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setKeyStoreOptions(new io.vertx.core.net.JksOptions((JsonObject)member.getValue()));
|
||||
obj.setKeyStoreOptions(io.vertx.core.net.JksOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "logActivity":
|
||||
@@ -120,27 +129,27 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "openSslEngineOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setOpenSslEngineOptions(new io.vertx.core.net.OpenSSLEngineOptions((JsonObject)member.getValue()));
|
||||
obj.setOpenSslEngineOptions(io.vertx.core.net.OpenSSLEngineOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pemKeyCertOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPemKeyCertOptions(new io.vertx.core.net.PemKeyCertOptions((JsonObject)member.getValue()));
|
||||
obj.setPemKeyCertOptions(io.vertx.core.net.PemKeyCertOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pemTrustOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPemTrustOptions(new io.vertx.core.net.PemTrustOptions((JsonObject)member.getValue()));
|
||||
obj.setPemTrustOptions(io.vertx.core.net.PemTrustOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pfxKeyCertOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPfxKeyCertOptions(new io.vertx.core.net.PfxOptions((JsonObject)member.getValue()));
|
||||
obj.setPfxKeyCertOptions(io.vertx.core.net.PfxOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pfxTrustOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPfxTrustOptions(new io.vertx.core.net.PfxOptions((JsonObject)member.getValue()));
|
||||
obj.setPfxTrustOptions(io.vertx.core.net.PfxOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "port":
|
||||
@@ -235,7 +244,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "trustStoreOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setTrustStoreOptions(new io.vertx.core.net.JksOptions((JsonObject)member.getValue()));
|
||||
obj.setTrustStoreOptions(io.vertx.core.net.JksOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "useAlpn":
|
||||
@@ -292,26 +301,26 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("idleTimeoutUnit", obj.getIdleTimeoutUnit().name());
|
||||
}
|
||||
if (obj.getJdkSslEngineOptions() != null) {
|
||||
json.put("jdkSslEngineOptions", obj.getJdkSslEngineOptions().toJson());
|
||||
json.put("jdkSslEngineOptions", io.vertx.core.net.JdkSSLEngineOptionsConverter.INSTANCE.encode(obj.getJdkSslEngineOptions()));
|
||||
}
|
||||
if (obj.getKeyStoreOptions() != null) {
|
||||
json.put("keyStoreOptions", obj.getKeyStoreOptions().toJson());
|
||||
json.put("keyStoreOptions", io.vertx.core.net.JksOptionsConverter.INSTANCE.encode(obj.getKeyStoreOptions()));
|
||||
}
|
||||
json.put("logActivity", obj.getLogActivity());
|
||||
if (obj.getOpenSslEngineOptions() != null) {
|
||||
json.put("openSslEngineOptions", obj.getOpenSslEngineOptions().toJson());
|
||||
json.put("openSslEngineOptions", io.vertx.core.net.OpenSSLEngineOptionsConverter.INSTANCE.encode(obj.getOpenSslEngineOptions()));
|
||||
}
|
||||
if (obj.getPemKeyCertOptions() != null) {
|
||||
json.put("pemKeyCertOptions", obj.getPemKeyCertOptions().toJson());
|
||||
json.put("pemKeyCertOptions", io.vertx.core.net.PemKeyCertOptionsConverter.INSTANCE.encode(obj.getPemKeyCertOptions()));
|
||||
}
|
||||
if (obj.getPemTrustOptions() != null) {
|
||||
json.put("pemTrustOptions", obj.getPemTrustOptions().toJson());
|
||||
json.put("pemTrustOptions", io.vertx.core.net.PemTrustOptionsConverter.INSTANCE.encode(obj.getPemTrustOptions()));
|
||||
}
|
||||
if (obj.getPfxKeyCertOptions() != null) {
|
||||
json.put("pfxKeyCertOptions", obj.getPfxKeyCertOptions().toJson());
|
||||
json.put("pfxKeyCertOptions", io.vertx.core.net.PfxOptionsConverter.INSTANCE.encode(obj.getPfxKeyCertOptions()));
|
||||
}
|
||||
if (obj.getPfxTrustOptions() != null) {
|
||||
json.put("pfxTrustOptions", obj.getPfxTrustOptions().toJson());
|
||||
json.put("pfxTrustOptions", io.vertx.core.net.PfxOptionsConverter.INSTANCE.encode(obj.getPfxTrustOptions()));
|
||||
}
|
||||
json.put("port", obj.getPort());
|
||||
json.put("receiveBufferSize", obj.getReceiveBufferSize());
|
||||
@@ -334,7 +343,7 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("trafficClass", obj.getTrafficClass());
|
||||
json.put("trustAll", obj.isTrustAll());
|
||||
if (obj.getTrustStoreOptions() != null) {
|
||||
json.put("trustStoreOptions", obj.getTrustStoreOptions().toJson());
|
||||
json.put("trustStoreOptions", io.vertx.core.net.JksOptionsConverter.INSTANCE.encode(obj.getTrustStoreOptions()));
|
||||
}
|
||||
json.put("useAlpn", obj.isUseAlpn());
|
||||
}
|
||||
|
||||
@@ -4,12 +4,27 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.file.CopyOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.file.CopyOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.file.CopyOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class CopyOptionsConverter {
|
||||
public class CopyOptionsConverter implements JsonCodec<CopyOptions, JsonObject> {
|
||||
|
||||
public static final CopyOptionsConverter INSTANCE = new CopyOptionsConverter();
|
||||
|
||||
@Override
|
||||
public JsonObject encode(CopyOptions value) {
|
||||
if (value == null) return null;
|
||||
JsonObject json = new JsonObject();
|
||||
toJson(value, json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override public CopyOptions decode(JsonObject value) { return (value != null) ? new CopyOptions(value) : null; }
|
||||
|
||||
@Override public Class<CopyOptions> getTargetClass() { return CopyOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, CopyOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.file.FileSystemOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.file.FileSystemOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.file.FileSystemOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class FileSystemOptionsConverter {
|
||||
public class FileSystemOptionsConverter implements JsonCodec<FileSystemOptions, JsonObject> {
|
||||
|
||||
public static final FileSystemOptionsConverter INSTANCE = new FileSystemOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(FileSystemOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public FileSystemOptions decode(JsonObject value) { return (value != null) ? new FileSystemOptions(value) : null; }
|
||||
|
||||
@Override public Class<FileSystemOptions> getTargetClass() { return FileSystemOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, FileSystemOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,27 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.file.OpenOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.file.OpenOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.file.OpenOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class OpenOptionsConverter {
|
||||
public class OpenOptionsConverter implements JsonCodec<OpenOptions, JsonObject> {
|
||||
|
||||
public static final OpenOptionsConverter INSTANCE = new OpenOptionsConverter();
|
||||
|
||||
@Override
|
||||
public JsonObject encode(OpenOptions value) {
|
||||
if (value == null) return null;
|
||||
JsonObject json = new JsonObject();
|
||||
toJson(value, json);
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override public OpenOptions decode(JsonObject value) { return (value != null) ? new OpenOptions(value) : null; }
|
||||
|
||||
@Override public Class<OpenOptions> getTargetClass() { return OpenOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, OpenOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.http.GoAway}.
|
||||
* Converter and Codec for {@link io.vertx.core.http.GoAway}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.GoAway} original class using Vert.x codegen.
|
||||
*/
|
||||
class GoAwayConverter {
|
||||
public class GoAwayConverter implements JsonCodec<GoAway, JsonObject> {
|
||||
|
||||
public static final GoAwayConverter INSTANCE = new GoAwayConverter();
|
||||
|
||||
@Override public JsonObject encode(GoAway value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public GoAway decode(JsonObject value) { return (value != null) ? new GoAway(value) : null; }
|
||||
|
||||
@Override public Class<GoAway> getTargetClass() { return GoAway.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, GoAway obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.http.Http2Settings}.
|
||||
* Converter and Codec for {@link io.vertx.core.http.Http2Settings}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.Http2Settings} original class using Vert.x codegen.
|
||||
*/
|
||||
class Http2SettingsConverter {
|
||||
public class Http2SettingsConverter implements JsonCodec<Http2Settings, JsonObject> {
|
||||
|
||||
public static final Http2SettingsConverter INSTANCE = new Http2SettingsConverter();
|
||||
|
||||
@Override public JsonObject encode(Http2Settings value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public Http2Settings decode(JsonObject value) { return (value != null) ? new Http2Settings(value) : null; }
|
||||
|
||||
@Override public Class<Http2Settings> getTargetClass() { return Http2Settings.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, Http2Settings obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.http.HttpClientOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.http.HttpClientOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.HttpClientOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class HttpClientOptionsConverter {
|
||||
public class HttpClientOptionsConverter implements JsonCodec<HttpClientOptions, JsonObject> {
|
||||
|
||||
public static final HttpClientOptionsConverter INSTANCE = new HttpClientOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(HttpClientOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public HttpClientOptions decode(JsonObject value) { return (value != null) ? new HttpClientOptions(value) : null; }
|
||||
|
||||
@Override public Class<HttpClientOptions> getTargetClass() { return HttpClientOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, HttpClientOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
@@ -71,7 +80,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "initialSettings":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setInitialSettings(new io.vertx.core.http.Http2Settings((JsonObject)member.getValue()));
|
||||
obj.setInitialSettings(io.vertx.core.http.Http2SettingsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "keepAlive":
|
||||
@@ -212,7 +221,7 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("http2MaxPoolSize", obj.getHttp2MaxPoolSize());
|
||||
json.put("http2MultiplexingLimit", obj.getHttp2MultiplexingLimit());
|
||||
if (obj.getInitialSettings() != null) {
|
||||
json.put("initialSettings", obj.getInitialSettings().toJson());
|
||||
json.put("initialSettings", io.vertx.core.http.Http2SettingsConverter.INSTANCE.encode(obj.getInitialSettings()));
|
||||
}
|
||||
json.put("keepAlive", obj.isKeepAlive());
|
||||
json.put("keepAliveTimeout", obj.getKeepAliveTimeout());
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.http.HttpServerOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.http.HttpServerOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.HttpServerOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class HttpServerOptionsConverter {
|
||||
public class HttpServerOptionsConverter implements JsonCodec<HttpServerOptions, JsonObject> {
|
||||
|
||||
public static final HttpServerOptionsConverter INSTANCE = new HttpServerOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(HttpServerOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public HttpServerOptions decode(JsonObject value) { return (value != null) ? new HttpServerOptions(value) : null; }
|
||||
|
||||
@Override public Class<HttpServerOptions> getTargetClass() { return HttpServerOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, HttpServerOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
@@ -61,7 +70,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "initialSettings":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setInitialSettings(new io.vertx.core.http.Http2Settings((JsonObject)member.getValue()));
|
||||
obj.setInitialSettings(io.vertx.core.http.Http2SettingsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "maxChunkSize":
|
||||
@@ -141,7 +150,7 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("handle100ContinueAutomatically", obj.isHandle100ContinueAutomatically());
|
||||
json.put("http2ConnectionWindowSize", obj.getHttp2ConnectionWindowSize());
|
||||
if (obj.getInitialSettings() != null) {
|
||||
json.put("initialSettings", obj.getInitialSettings().toJson());
|
||||
json.put("initialSettings", io.vertx.core.http.Http2SettingsConverter.INSTANCE.encode(obj.getInitialSettings()));
|
||||
}
|
||||
json.put("maxChunkSize", obj.getMaxChunkSize());
|
||||
json.put("maxHeaderSize", obj.getMaxHeaderSize());
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.http.RequestOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.http.RequestOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.RequestOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
public class RequestOptionsConverter {
|
||||
public class RequestOptionsConverter implements JsonCodec<RequestOptions, JsonObject> {
|
||||
|
||||
public static final RequestOptionsConverter INSTANCE = new RequestOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(RequestOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public RequestOptions decode(JsonObject value) { return (value != null) ? new RequestOptions(value) : null; }
|
||||
|
||||
@Override public Class<RequestOptions> getTargetClass() { return RequestOptions.class; }
|
||||
|
||||
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, RequestOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.vertx.core.http;
|
||||
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter and Codec for {@link io.vertx.core.http.StreamPriority}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.StreamPriority} original class using Vert.x codegen.
|
||||
*/
|
||||
public class StreamPriorityConverter implements JsonCodec<StreamPriority, JsonObject> {
|
||||
|
||||
public static final StreamPriorityConverter INSTANCE = new StreamPriorityConverter();
|
||||
|
||||
@Override public JsonObject encode(StreamPriority value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public StreamPriority decode(JsonObject value) { return (value != null) ? new StreamPriority(value) : null; }
|
||||
|
||||
@Override public Class<StreamPriority> getTargetClass() { return StreamPriority.class; }
|
||||
}
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.http.WebSocketConnectOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.http.WebSocketConnectOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.http.WebSocketConnectOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
public class WebSocketConnectOptionsConverter {
|
||||
public class WebSocketConnectOptionsConverter implements JsonCodec<WebSocketConnectOptions, JsonObject> {
|
||||
|
||||
public static final WebSocketConnectOptionsConverter INSTANCE = new WebSocketConnectOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(WebSocketConnectOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public WebSocketConnectOptions decode(JsonObject value) { return (value != null) ? new WebSocketConnectOptions(value) : null; }
|
||||
|
||||
@Override public Class<WebSocketConnectOptions> getTargetClass() { return WebSocketConnectOptions.class; }
|
||||
|
||||
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, WebSocketConnectOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.metrics.MetricsOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.metrics.MetricsOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.metrics.MetricsOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class MetricsOptionsConverter {
|
||||
public class MetricsOptionsConverter implements JsonCodec<MetricsOptions, JsonObject> {
|
||||
|
||||
public static final MetricsOptionsConverter INSTANCE = new MetricsOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(MetricsOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public MetricsOptions decode(JsonObject value) { return (value != null) ? new MetricsOptions(value) : null; }
|
||||
|
||||
@Override public Class<MetricsOptions> getTargetClass() { return MetricsOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, MetricsOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,19 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonEncoder;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.ClientOptionsBase}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.ClientOptionsBase}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.ClientOptionsBase} original class using Vert.x codegen.
|
||||
*/
|
||||
class ClientOptionsBaseConverter {
|
||||
public class ClientOptionsBaseConverter implements JsonEncoder<ClientOptionsBase, JsonObject> {
|
||||
|
||||
public static final ClientOptionsBaseConverter INSTANCE = new ClientOptionsBaseConverter();
|
||||
|
||||
@Override public JsonObject encode(ClientOptionsBase value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public Class<ClientOptionsBase> getTargetClass() { return ClientOptionsBase.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, ClientOptionsBase obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
@@ -31,7 +38,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "proxyOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setProxyOptions(new io.vertx.core.net.ProxyOptions((JsonObject)member.getValue()));
|
||||
obj.setProxyOptions(io.vertx.core.net.ProxyOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "trustAll":
|
||||
@@ -56,7 +63,7 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("metricsName", obj.getMetricsName());
|
||||
}
|
||||
if (obj.getProxyOptions() != null) {
|
||||
json.put("proxyOptions", obj.getProxyOptions().toJson());
|
||||
json.put("proxyOptions", io.vertx.core.net.ProxyOptionsConverter.INSTANCE.encode(obj.getProxyOptions()));
|
||||
}
|
||||
json.put("trustAll", obj.isTrustAll());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package io.vertx.core.net;
|
||||
|
||||
import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter and Codec for {@link io.vertx.core.net.JdkSSLEngineOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.JdkSSLEngineOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
public class JdkSSLEngineOptionsConverter implements JsonCodec<JdkSSLEngineOptions, JsonObject> {
|
||||
|
||||
public static final JdkSSLEngineOptionsConverter INSTANCE = new JdkSSLEngineOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(JdkSSLEngineOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public JdkSSLEngineOptions decode(JsonObject value) { return (value != null) ? new JdkSSLEngineOptions(value) : null; }
|
||||
|
||||
@Override public Class<JdkSSLEngineOptions> getTargetClass() { return JdkSSLEngineOptions.class; }
|
||||
}
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.JksOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.JksOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.JksOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
public class JksOptionsConverter {
|
||||
public class JksOptionsConverter implements JsonCodec<JksOptions, JsonObject> {
|
||||
|
||||
public static final JksOptionsConverter INSTANCE = new JksOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(JksOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public JksOptions decode(JsonObject value) { return (value != null) ? new JksOptions(value) : null; }
|
||||
|
||||
@Override public Class<JksOptions> getTargetClass() { return JksOptions.class; }
|
||||
|
||||
public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, JksOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.NetClientOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.NetClientOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.NetClientOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class NetClientOptionsConverter {
|
||||
public class NetClientOptionsConverter implements JsonCodec<NetClientOptions, JsonObject> {
|
||||
|
||||
public static final NetClientOptionsConverter INSTANCE = new NetClientOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(NetClientOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public NetClientOptions decode(JsonObject value) { return (value != null) ? new NetClientOptions(value) : null; }
|
||||
|
||||
@Override public Class<NetClientOptions> getTargetClass() { return NetClientOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, NetClientOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.NetServerOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.NetServerOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.NetServerOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class NetServerOptionsConverter {
|
||||
public class NetServerOptionsConverter implements JsonCodec<NetServerOptions, JsonObject> {
|
||||
|
||||
public static final NetServerOptionsConverter INSTANCE = new NetServerOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(NetServerOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public NetServerOptions decode(JsonObject value) { return (value != null) ? new NetServerOptions(value) : null; }
|
||||
|
||||
@Override public Class<NetServerOptions> getTargetClass() { return NetServerOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, NetServerOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,19 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonEncoder;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.NetworkOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.NetworkOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.NetworkOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class NetworkOptionsConverter {
|
||||
public class NetworkOptionsConverter implements JsonEncoder<NetworkOptions, JsonObject> {
|
||||
|
||||
public static final NetworkOptionsConverter INSTANCE = new NetworkOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(NetworkOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public Class<NetworkOptions> getTargetClass() { return NetworkOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, NetworkOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.OpenSSLEngineOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.OpenSSLEngineOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.OpenSSLEngineOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class OpenSSLEngineOptionsConverter {
|
||||
public class OpenSSLEngineOptionsConverter implements JsonCodec<OpenSSLEngineOptions, JsonObject> {
|
||||
|
||||
public static final OpenSSLEngineOptionsConverter INSTANCE = new OpenSSLEngineOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(OpenSSLEngineOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public OpenSSLEngineOptions decode(JsonObject value) { return (value != null) ? new OpenSSLEngineOptions(value) : null; }
|
||||
|
||||
@Override public Class<OpenSSLEngineOptions> getTargetClass() { return OpenSSLEngineOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, OpenSSLEngineOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.PemKeyCertOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.PemKeyCertOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.PemKeyCertOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class PemKeyCertOptionsConverter {
|
||||
public class PemKeyCertOptionsConverter implements JsonCodec<PemKeyCertOptions, JsonObject> {
|
||||
|
||||
public static final PemKeyCertOptionsConverter INSTANCE = new PemKeyCertOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(PemKeyCertOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public PemKeyCertOptions decode(JsonObject value) { return (value != null) ? new PemKeyCertOptions(value) : null; }
|
||||
|
||||
@Override public Class<PemKeyCertOptions> getTargetClass() { return PemKeyCertOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PemKeyCertOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.PemTrustOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.PemTrustOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.PemTrustOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class PemTrustOptionsConverter {
|
||||
public class PemTrustOptionsConverter implements JsonCodec<PemTrustOptions, JsonObject> {
|
||||
|
||||
public static final PemTrustOptionsConverter INSTANCE = new PemTrustOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(PemTrustOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public PemTrustOptions decode(JsonObject value) { return (value != null) ? new PemTrustOptions(value) : null; }
|
||||
|
||||
@Override public Class<PemTrustOptions> getTargetClass() { return PemTrustOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PemTrustOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.PfxOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.PfxOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.PfxOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class PfxOptionsConverter {
|
||||
public class PfxOptionsConverter implements JsonCodec<PfxOptions, JsonObject> {
|
||||
|
||||
public static final PfxOptionsConverter INSTANCE = new PfxOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(PfxOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public PfxOptions decode(JsonObject value) { return (value != null) ? new PfxOptions(value) : null; }
|
||||
|
||||
@Override public Class<PfxOptions> getTargetClass() { return PfxOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, PfxOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.ProxyOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.ProxyOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.ProxyOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class ProxyOptionsConverter {
|
||||
public class ProxyOptionsConverter implements JsonCodec<ProxyOptions, JsonObject> {
|
||||
|
||||
public static final ProxyOptionsConverter INSTANCE = new ProxyOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(ProxyOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public ProxyOptions decode(JsonObject value) { return (value != null) ? new ProxyOptions(value) : null; }
|
||||
|
||||
@Override public Class<ProxyOptions> getTargetClass() { return ProxyOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, ProxyOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
@@ -4,12 +4,19 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonEncoder;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.net.TCPSSLOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.net.TCPSSLOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.net.TCPSSLOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class TCPSSLOptionsConverter {
|
||||
public class TCPSSLOptionsConverter implements JsonEncoder<TCPSSLOptions, JsonObject> {
|
||||
|
||||
public static final TCPSSLOptionsConverter INSTANCE = new TCPSSLOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(TCPSSLOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public Class<TCPSSLOptions> getTargetClass() { return TCPSSLOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TCPSSLOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
@@ -60,37 +67,37 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "jdkSslEngineOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setJdkSslEngineOptions(new io.vertx.core.net.JdkSSLEngineOptions((JsonObject)member.getValue()));
|
||||
obj.setJdkSslEngineOptions(io.vertx.core.net.JdkSSLEngineOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "keyStoreOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setKeyStoreOptions(new io.vertx.core.net.JksOptions((JsonObject)member.getValue()));
|
||||
obj.setKeyStoreOptions(io.vertx.core.net.JksOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "openSslEngineOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setOpenSslEngineOptions(new io.vertx.core.net.OpenSSLEngineOptions((JsonObject)member.getValue()));
|
||||
obj.setOpenSslEngineOptions(io.vertx.core.net.OpenSSLEngineOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pemKeyCertOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPemKeyCertOptions(new io.vertx.core.net.PemKeyCertOptions((JsonObject)member.getValue()));
|
||||
obj.setPemKeyCertOptions(io.vertx.core.net.PemKeyCertOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pemTrustOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPemTrustOptions(new io.vertx.core.net.PemTrustOptions((JsonObject)member.getValue()));
|
||||
obj.setPemTrustOptions(io.vertx.core.net.PemTrustOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pfxKeyCertOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPfxKeyCertOptions(new io.vertx.core.net.PfxOptions((JsonObject)member.getValue()));
|
||||
obj.setPfxKeyCertOptions(io.vertx.core.net.PfxOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "pfxTrustOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setPfxTrustOptions(new io.vertx.core.net.PfxOptions((JsonObject)member.getValue()));
|
||||
obj.setPfxTrustOptions(io.vertx.core.net.PfxOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "soLinger":
|
||||
@@ -140,7 +147,7 @@ import java.time.format.DateTimeFormatter;
|
||||
break;
|
||||
case "trustStoreOptions":
|
||||
if (member.getValue() instanceof JsonObject) {
|
||||
obj.setTrustStoreOptions(new io.vertx.core.net.JksOptions((JsonObject)member.getValue()));
|
||||
obj.setTrustStoreOptions(io.vertx.core.net.JksOptionsConverter.INSTANCE.decode((JsonObject)member.getValue()));
|
||||
}
|
||||
break;
|
||||
case "useAlpn":
|
||||
@@ -182,25 +189,25 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("idleTimeoutUnit", obj.getIdleTimeoutUnit().name());
|
||||
}
|
||||
if (obj.getJdkSslEngineOptions() != null) {
|
||||
json.put("jdkSslEngineOptions", obj.getJdkSslEngineOptions().toJson());
|
||||
json.put("jdkSslEngineOptions", io.vertx.core.net.JdkSSLEngineOptionsConverter.INSTANCE.encode(obj.getJdkSslEngineOptions()));
|
||||
}
|
||||
if (obj.getKeyStoreOptions() != null) {
|
||||
json.put("keyStoreOptions", obj.getKeyStoreOptions().toJson());
|
||||
json.put("keyStoreOptions", io.vertx.core.net.JksOptionsConverter.INSTANCE.encode(obj.getKeyStoreOptions()));
|
||||
}
|
||||
if (obj.getOpenSslEngineOptions() != null) {
|
||||
json.put("openSslEngineOptions", obj.getOpenSslEngineOptions().toJson());
|
||||
json.put("openSslEngineOptions", io.vertx.core.net.OpenSSLEngineOptionsConverter.INSTANCE.encode(obj.getOpenSslEngineOptions()));
|
||||
}
|
||||
if (obj.getPemKeyCertOptions() != null) {
|
||||
json.put("pemKeyCertOptions", obj.getPemKeyCertOptions().toJson());
|
||||
json.put("pemKeyCertOptions", io.vertx.core.net.PemKeyCertOptionsConverter.INSTANCE.encode(obj.getPemKeyCertOptions()));
|
||||
}
|
||||
if (obj.getPemTrustOptions() != null) {
|
||||
json.put("pemTrustOptions", obj.getPemTrustOptions().toJson());
|
||||
json.put("pemTrustOptions", io.vertx.core.net.PemTrustOptionsConverter.INSTANCE.encode(obj.getPemTrustOptions()));
|
||||
}
|
||||
if (obj.getPfxKeyCertOptions() != null) {
|
||||
json.put("pfxKeyCertOptions", obj.getPfxKeyCertOptions().toJson());
|
||||
json.put("pfxKeyCertOptions", io.vertx.core.net.PfxOptionsConverter.INSTANCE.encode(obj.getPfxKeyCertOptions()));
|
||||
}
|
||||
if (obj.getPfxTrustOptions() != null) {
|
||||
json.put("pfxTrustOptions", obj.getPfxTrustOptions().toJson());
|
||||
json.put("pfxTrustOptions", io.vertx.core.net.PfxOptionsConverter.INSTANCE.encode(obj.getPfxTrustOptions()));
|
||||
}
|
||||
json.put("soLinger", obj.getSoLinger());
|
||||
json.put("ssl", obj.isSsl());
|
||||
@@ -214,7 +221,7 @@ import java.time.format.DateTimeFormatter;
|
||||
json.put("tcpNoDelay", obj.isTcpNoDelay());
|
||||
json.put("tcpQuickAck", obj.isTcpQuickAck());
|
||||
if (obj.getTrustStoreOptions() != null) {
|
||||
json.put("trustStoreOptions", obj.getTrustStoreOptions().toJson());
|
||||
json.put("trustStoreOptions", io.vertx.core.net.JksOptionsConverter.INSTANCE.encode(obj.getTrustStoreOptions()));
|
||||
}
|
||||
json.put("useAlpn", obj.isUseAlpn());
|
||||
}
|
||||
|
||||
@@ -4,12 +4,21 @@ import io.vertx.core.json.JsonObject;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import java.time.Instant;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
/**
|
||||
* Converter for {@link io.vertx.core.tracing.TracingOptions}.
|
||||
* Converter and Codec for {@link io.vertx.core.tracing.TracingOptions}.
|
||||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.tracing.TracingOptions} original class using Vert.x codegen.
|
||||
*/
|
||||
class TracingOptionsConverter {
|
||||
public class TracingOptionsConverter implements JsonCodec<TracingOptions, JsonObject> {
|
||||
|
||||
public static final TracingOptionsConverter INSTANCE = new TracingOptionsConverter();
|
||||
|
||||
@Override public JsonObject encode(TracingOptions value) { return (value != null) ? value.toJson() : null; }
|
||||
|
||||
@Override public TracingOptions decode(JsonObject value) { return (value != null) ? new TracingOptions(value) : null; }
|
||||
|
||||
@Override public Class<TracingOptions> getTargetClass() { return TracingOptions.class; }
|
||||
|
||||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, TracingOptions obj) {
|
||||
for (java.util.Map.Entry<String, Object> member : json) {
|
||||
|
||||
56
src/main/java/io/vertx/core/json/JsonCodecMapper.java
Normal file
56
src/main/java/io/vertx/core/json/JsonCodecMapper.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package io.vertx.core.json;
|
||||
|
||||
import io.vertx.core.buffer.Buffer;
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
class JsonCodecMapper {
|
||||
|
||||
private static final Map<Class, JsonCodec> codecMap;
|
||||
|
||||
static {
|
||||
Map<Class, JsonCodec> map = new HashMap<>();
|
||||
ServiceLoader<JsonCodec> codecServiceLoader = ServiceLoader.load(JsonCodec.class);
|
||||
for (JsonCodec j : codecServiceLoader) {
|
||||
map.put(j.getTargetClass(), j);
|
||||
}
|
||||
codecMap = map;
|
||||
}
|
||||
|
||||
private static <T> JsonCodec codec(Class<T> c) {
|
||||
return codecMap.get(c);
|
||||
}
|
||||
|
||||
public static <T> T decode(Object json, Class<T> c) {
|
||||
if (json == null) {
|
||||
return null;
|
||||
}
|
||||
JsonCodec<T, Object> codec = (JsonCodec<T, Object>) codecMap.get(c);
|
||||
if (codec == null) {
|
||||
throw new IllegalStateException("Unable to find codec for class " + c.getName());
|
||||
}
|
||||
return codec.decode(json);
|
||||
}
|
||||
|
||||
public static <T> T decodeBuffer(Buffer value, Class<T> c) {
|
||||
return decode(Json.decodeValue(value), c);
|
||||
}
|
||||
|
||||
public static Object encode(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
JsonCodec<Object, Object> codec = (JsonCodec<Object, Object>) codecMap.get(value.getClass());
|
||||
if (codec == null) {
|
||||
throw new IllegalStateException("Unable to find codec for class " + value.getClass().getName());
|
||||
}
|
||||
return codec.encode(value);
|
||||
}
|
||||
|
||||
public static Buffer encodeBuffer(Object value) {
|
||||
return Json.encodeToBuffer(encode(value));
|
||||
}
|
||||
}
|
||||
25
src/main/java/io/vertx/core/spi/json/JsonCodec.java
Normal file
25
src/main/java/io/vertx/core/spi/json/JsonCodec.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package io.vertx.core.spi.json;
|
||||
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
|
||||
/**
|
||||
* Converts {@code <T>} back and forth to {@code <J>}.
|
||||
* <br/>
|
||||
* {@code <T>} can be any class or interface type, {@code <J>} can be one of the following:
|
||||
* <ul>
|
||||
* <li>{@link JsonObject}</li>
|
||||
* <li>{@link JsonArray}</li>
|
||||
* <li>{@link String}</li>
|
||||
* <li>{@link Number}</li>
|
||||
* <li>{@link Boolean}</li>
|
||||
* </ul>
|
||||
*
|
||||
* To use it in {@code @ModuleGen} annotation you must provide
|
||||
* a {@code public static final [JsonCodecType] INSTANCE}.
|
||||
*
|
||||
* @param <T> the type encoded to Json
|
||||
* @param <J> the json type
|
||||
*/
|
||||
public interface JsonCodec<T, J> extends JsonEncoder<T, J>, JsonDecoder<T, J> {
|
||||
}
|
||||
38
src/main/java/io/vertx/core/spi/json/JsonDecoder.java
Normal file
38
src/main/java/io/vertx/core/spi/json/JsonDecoder.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package io.vertx.core.spi.json;
|
||||
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
|
||||
/**
|
||||
* Converts {@code <T>} type to {@code <J>}.
|
||||
* <br/>
|
||||
* {@code <T>} can be any class or interface type, {@code <J>} can be one of the following:
|
||||
* <ul>
|
||||
* <li>{@link JsonObject}</li>
|
||||
* <li>{@link JsonArray}</li>
|
||||
* <li>{@link String}</li>
|
||||
* <li>{@link Number}</li>
|
||||
* <li>{@link Boolean}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param <T> the type decoded from Json
|
||||
* @param <J> the json type
|
||||
*/
|
||||
public interface JsonDecoder<T, J> {
|
||||
|
||||
/**
|
||||
* Decode {@code <J>} to {@code <T>}.
|
||||
* <br/>
|
||||
* The {@code json} will not be {@code null} and the implementation must not return {@code null}.
|
||||
*
|
||||
* @param json the json value
|
||||
* @return the decoded value
|
||||
* @throws IllegalArgumentException when it cannot decode the value
|
||||
*/
|
||||
T decode(J json) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* @return the class for {@code <T>}
|
||||
*/
|
||||
Class<T> getTargetClass();
|
||||
}
|
||||
38
src/main/java/io/vertx/core/spi/json/JsonEncoder.java
Normal file
38
src/main/java/io/vertx/core/spi/json/JsonEncoder.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package io.vertx.core.spi.json;
|
||||
|
||||
import io.vertx.core.json.JsonArray;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
|
||||
/**
|
||||
* Converts {@code <J>} type to {@code <T>}.
|
||||
* <br/>
|
||||
* {@code <T>} can be any class or interface type, {@code <J>} can be one of the following:
|
||||
* <ul>
|
||||
* <li>{@link JsonObject}</li>
|
||||
* <li>{@link JsonArray}</li>
|
||||
* <li>{@link String}</li>
|
||||
* <li>{@link Number}</li>
|
||||
* <li>{@link Boolean}</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param <T> the type encoded to Json
|
||||
* @param <J> the json type
|
||||
*/
|
||||
public interface JsonEncoder<T, J> {
|
||||
|
||||
/**
|
||||
* Encode {@code <T>} to {@code <J>}.
|
||||
* <br/>
|
||||
* The {@code value} will not be {@code null} and the implementation must not return {@code null}.
|
||||
*
|
||||
* @param value the value
|
||||
* @return the encoded json value
|
||||
* @throws IllegalArgumentException when it cannot decode the value
|
||||
*/
|
||||
J encode(T value) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* @return the class for {@code <T>}
|
||||
*/
|
||||
Class<T> getTargetClass();
|
||||
}
|
||||
117
src/test/java/io/vertx/core/json/JsonCodecLoaderTest.java
Normal file
117
src/test/java/io/vertx/core/json/JsonCodecLoaderTest.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package io.vertx.core.json;
|
||||
|
||||
import io.vertx.core.json.codecs.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import static io.vertx.core.json.Json.encodeToBuffer;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class JsonCodecLoaderTest {
|
||||
|
||||
@Test
|
||||
public void booleanCodecTest() {
|
||||
MyBooleanPojo pojo = new MyBooleanPojo();
|
||||
pojo.setValue(true);
|
||||
assertEquals(encodeToBuffer(true), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(encodeToBuffer(true), MyBooleanPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void booleanCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer("aaa"), MyBooleanPojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doubleCodecTest() {
|
||||
MyDoublePojo pojo = new MyDoublePojo();
|
||||
pojo.setValue(1.2d);
|
||||
assertEquals(encodeToBuffer(1.2d), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(encodeToBuffer(1.2d), MyDoublePojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void doubleCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(""), MyDoublePojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void floatCodecTest() {
|
||||
MyFloatPojo pojo = new MyFloatPojo();
|
||||
pojo.setValue(1.2f);
|
||||
assertEquals(encodeToBuffer(1.2f), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(encodeToBuffer(1.2f), MyFloatPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void floatCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(""), MyFloatPojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void intCodecTest() {
|
||||
MyIntegerPojo pojo = new MyIntegerPojo();
|
||||
pojo.setValue(1);
|
||||
assertEquals(encodeToBuffer((int)1), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(encodeToBuffer((int)1), MyIntegerPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void intCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(""), MyIntegerPojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void longCodecTest() {
|
||||
MyLongPojo pojo = new MyLongPojo();
|
||||
pojo.setValue(1L);
|
||||
assertEquals(encodeToBuffer(1L), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(encodeToBuffer(1L), MyLongPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void longCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(""), MyLongPojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shortCodecTest() {
|
||||
MyShortPojo pojo = new MyShortPojo();
|
||||
pojo.setValue((short)1);
|
||||
assertEquals(encodeToBuffer((short)1), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(encodeToBuffer((short)1), MyShortPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void shortCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(""), MyShortPojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jsonArrayCodecTest() {
|
||||
MyJsonArrayPojo pojo = new MyJsonArrayPojo();
|
||||
JsonArray array = new JsonArray().add(1).add(2).add(3);
|
||||
pojo.setValue(array);
|
||||
assertEquals(array.toBuffer(), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(array.toBuffer(), MyJsonArrayPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void jsonArrayCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(2), MyJsonArrayPojo.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jsonObjectCodecTest() {
|
||||
MyJsonObjectPojo pojo = new MyJsonObjectPojo();
|
||||
JsonObject obj = new JsonObject().put("a", 1).put("b", "c");
|
||||
pojo.setValue(obj);
|
||||
assertEquals(obj.toBuffer(), JsonCodecMapper.encodeBuffer(pojo));
|
||||
assertEquals(pojo, JsonCodecMapper.decodeBuffer(obj.toBuffer(), MyJsonObjectPojo.class));
|
||||
}
|
||||
|
||||
@Test(expected = ClassCastException.class)
|
||||
public void jsonObjectCodecWrongTypeTest() {
|
||||
JsonCodecMapper.decodeBuffer(encodeToBuffer(2), MyJsonObjectPojo.class);
|
||||
}
|
||||
|
||||
}
|
||||
50
src/test/java/io/vertx/core/json/codecs/MyBooleanPojo.java
Normal file
50
src/test/java/io/vertx/core/json/codecs/MyBooleanPojo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyBooleanPojo {
|
||||
|
||||
public static class MyBooleanPojoJsonCodec implements JsonCodec<MyBooleanPojo, Boolean> {
|
||||
|
||||
@Override
|
||||
public MyBooleanPojo decode(Boolean value) throws IllegalArgumentException {
|
||||
return new MyBooleanPojo().setValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean encode(MyBooleanPojo value) throws IllegalArgumentException {
|
||||
return value.isValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyBooleanPojo> getTargetClass() {
|
||||
return MyBooleanPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
boolean value;
|
||||
|
||||
public boolean isValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyBooleanPojo setValue(boolean value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyBooleanPojo that = (MyBooleanPojo) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
50
src/test/java/io/vertx/core/json/codecs/MyDoublePojo.java
Normal file
50
src/test/java/io/vertx/core/json/codecs/MyDoublePojo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyDoublePojo {
|
||||
|
||||
public static class MyDoublePojoJsonCodec implements JsonCodec<MyDoublePojo, Number> {
|
||||
|
||||
@Override
|
||||
public MyDoublePojo decode(Number value) throws IllegalArgumentException {
|
||||
return new MyDoublePojo().setValue(value.doubleValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double encode(MyDoublePojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyDoublePojo> getTargetClass() {
|
||||
return MyDoublePojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
double value;
|
||||
|
||||
public double getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyDoublePojo setValue(double value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyDoublePojo that = (MyDoublePojo) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
50
src/test/java/io/vertx/core/json/codecs/MyFloatPojo.java
Normal file
50
src/test/java/io/vertx/core/json/codecs/MyFloatPojo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyFloatPojo {
|
||||
|
||||
public static class MyFloatPojoJsonCodec implements JsonCodec<MyFloatPojo, Number> {
|
||||
|
||||
@Override
|
||||
public MyFloatPojo decode(Number value) throws IllegalArgumentException {
|
||||
return new MyFloatPojo().setValue(value.floatValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Float encode(MyFloatPojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyFloatPojo> getTargetClass() {
|
||||
return MyFloatPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
float value;
|
||||
|
||||
public float getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyFloatPojo setValue(float value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyFloatPojo that = (MyFloatPojo) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
50
src/test/java/io/vertx/core/json/codecs/MyIntegerPojo.java
Normal file
50
src/test/java/io/vertx/core/json/codecs/MyIntegerPojo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyIntegerPojo {
|
||||
|
||||
public static class MyIntegerPojoJsonCodec implements JsonCodec<MyIntegerPojo, Number> {
|
||||
|
||||
@Override
|
||||
public MyIntegerPojo decode(Number value) throws IllegalArgumentException {
|
||||
return new MyIntegerPojo().setValue(value.intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer encode(MyIntegerPojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyIntegerPojo> getTargetClass() {
|
||||
return MyIntegerPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
int value;
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyIntegerPojo setValue(int value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyIntegerPojo that = (MyIntegerPojo) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
51
src/test/java/io/vertx/core/json/codecs/MyJsonArrayPojo.java
Normal file
51
src/test/java/io/vertx/core/json/codecs/MyJsonArrayPojo.java
Normal file
@@ -0,0 +1,51 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
import io.vertx.core.json.JsonArray;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyJsonArrayPojo {
|
||||
|
||||
public static class MyJsonArrayPojoJsonCodec implements JsonCodec<MyJsonArrayPojo, JsonArray> {
|
||||
|
||||
@Override
|
||||
public MyJsonArrayPojo decode(JsonArray value) throws IllegalArgumentException {
|
||||
return new MyJsonArrayPojo().setValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonArray encode(MyJsonArrayPojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyJsonArrayPojo> getTargetClass() {
|
||||
return MyJsonArrayPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
JsonArray value;
|
||||
|
||||
public JsonArray getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyJsonArrayPojo setValue(JsonArray value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyJsonArrayPojo that = (MyJsonArrayPojo) o;
|
||||
return Objects.equals(value, that.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyJsonObjectPojo {
|
||||
|
||||
public static class MyJsonObjectPojoJsonCodec implements JsonCodec<MyJsonObjectPojo, JsonObject> {
|
||||
|
||||
@Override
|
||||
public MyJsonObjectPojo decode(JsonObject value) throws IllegalArgumentException {
|
||||
return new MyJsonObjectPojo().setValue(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JsonObject encode(MyJsonObjectPojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyJsonObjectPojo> getTargetClass() {
|
||||
return MyJsonObjectPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
JsonObject value;
|
||||
|
||||
public JsonObject getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyJsonObjectPojo setValue(JsonObject value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyJsonObjectPojo that = (MyJsonObjectPojo) o;
|
||||
return Objects.equals(value, that.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
50
src/test/java/io/vertx/core/json/codecs/MyLongPojo.java
Normal file
50
src/test/java/io/vertx/core/json/codecs/MyLongPojo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyLongPojo {
|
||||
|
||||
public static class MyLongPojoJsonCodec implements JsonCodec<MyLongPojo, Number> {
|
||||
|
||||
@Override
|
||||
public MyLongPojo decode(Number value) throws IllegalArgumentException {
|
||||
return new MyLongPojo().setValue(value.longValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long encode(MyLongPojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyLongPojo> getTargetClass() {
|
||||
return MyLongPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
long value;
|
||||
|
||||
public long getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyLongPojo setValue(long value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyLongPojo that = (MyLongPojo) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
50
src/test/java/io/vertx/core/json/codecs/MyShortPojo.java
Normal file
50
src/test/java/io/vertx/core/json/codecs/MyShortPojo.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package io.vertx.core.json.codecs;
|
||||
|
||||
import io.vertx.core.spi.json.JsonCodec;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class MyShortPojo {
|
||||
|
||||
public static class MyShortPojoJsonCodec implements JsonCodec<MyShortPojo, Number> {
|
||||
|
||||
@Override
|
||||
public MyShortPojo decode(Number value) throws IllegalArgumentException {
|
||||
return new MyShortPojo().setValue(value.shortValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Short encode(MyShortPojo value) throws IllegalArgumentException {
|
||||
return value.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MyShortPojo> getTargetClass() {
|
||||
return MyShortPojo.class;
|
||||
}
|
||||
}
|
||||
|
||||
short value;
|
||||
|
||||
public short getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public MyShortPojo setValue(short value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
MyShortPojo that = (MyShortPojo) o;
|
||||
return value == that.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(value);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
io.vertx.core.json.codecs.MyBooleanPojo$MyBooleanPojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyDoublePojo$MyDoublePojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyFloatPojo$MyFloatPojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyIntegerPojo$MyIntegerPojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyJsonArrayPojo$MyJsonArrayPojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyJsonObjectPojo$MyJsonObjectPojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyLongPojo$MyLongPojoJsonCodec
|
||||
io.vertx.core.json.codecs.MyShortPojo$MyShortPojoJsonCodec
|
||||
Reference in New Issue
Block a user