com.clinia.model.datapartition.V1AnyOperatorAllOfAny Maven / Gradle / Ivy
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
// - read more on https://github.com/clinia/api-clients-generation. DO NOT EDIT.
package com.clinia.model.datapartition;
import com.clinia.exceptions.CliniaRuntimeException;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.*;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.logging.Logger;
/** V1AnyOperatorAllOfAny */
@JsonDeserialize(using = V1AnyOperatorAllOfAny.Deserializer.class)
public interface V1AnyOperatorAllOfAny {
// V1AnyOperatorAllOfAny as List wrapper.
static V1AnyOperatorAllOfAny ofListOfString(List value) {
return new ListOfStringWrapper(value);
}
// V1AnyOperatorAllOfAny as List wrapper.
static V1AnyOperatorAllOfAny ofListOfBigDecimal(List value) {
return new ListOfBigDecimalWrapper(value);
}
// V1AnyOperatorAllOfAny as List wrapper.
static V1AnyOperatorAllOfAny ofListOfBoolean(List value) {
return new ListOfBooleanWrapper(value);
}
// V1AnyOperatorAllOfAny as List wrapper.
@JsonSerialize(using = ListOfStringWrapper.Serializer.class)
class ListOfStringWrapper implements V1AnyOperatorAllOfAny {
private final List value;
ListOfStringWrapper(List value) {
this.value = value;
}
public List getValue() {
return value;
}
static class Serializer extends JsonSerializer {
@Override
public void serialize(ListOfStringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeObject(value.getValue());
}
}
}
// V1AnyOperatorAllOfAny as List wrapper.
@JsonSerialize(using = ListOfBigDecimalWrapper.Serializer.class)
class ListOfBigDecimalWrapper implements V1AnyOperatorAllOfAny {
private final List value;
ListOfBigDecimalWrapper(List value) {
this.value = value;
}
public List getValue() {
return value;
}
static class Serializer extends JsonSerializer {
@Override
public void serialize(ListOfBigDecimalWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeObject(value.getValue());
}
}
}
// V1AnyOperatorAllOfAny as List wrapper.
@JsonSerialize(using = ListOfBooleanWrapper.Serializer.class)
class ListOfBooleanWrapper implements V1AnyOperatorAllOfAny {
private final List value;
ListOfBooleanWrapper(List value) {
this.value = value;
}
public List getValue() {
return value;
}
static class Serializer extends JsonSerializer {
@Override
public void serialize(ListOfBooleanWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException {
gen.writeObject(value.getValue());
}
}
}
class Deserializer extends JsonDeserializer {
private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName());
@Override
public V1AnyOperatorAllOfAny deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonNode tree = jp.readValueAsTree();
// deserialize List
if (tree.isArray()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
List value = parser.readValueAs(new TypeReference>() {});
return new V1AnyOperatorAllOfAny.ListOfStringWrapper(value);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)");
}
}
// deserialize List
if (tree.isArray()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
List value = parser.readValueAs(new TypeReference>() {});
return new V1AnyOperatorAllOfAny.ListOfBigDecimalWrapper(value);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)");
}
}
// deserialize List
if (tree.isArray()) {
try (JsonParser parser = tree.traverse(jp.getCodec())) {
List value = parser.readValueAs(new TypeReference>() {});
return new V1AnyOperatorAllOfAny.ListOfBooleanWrapper(value);
} catch (Exception e) {
// deserialization failed, continue
LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)");
}
}
throw new CliniaRuntimeException(String.format("Failed to deserialize json element: %s", tree));
}
/** Handle deserialization of the 'null' value. */
@Override
public V1AnyOperatorAllOfAny getNullValue(DeserializationContext ctxt) throws JsonMappingException {
throw new JsonMappingException(ctxt.getParser(), "V1AnyOperatorAllOfAny cannot be null");
}
}
}