package io.apibuilder.spec.v0.models; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import java.io.IOException; import java.lang.Boolean; import java.lang.Object; import java.lang.Override; import java.lang.String; import java.util.Arrays; /** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.16.74 * User agent: apibuilder app.apibuilder.io/apicollective/apibuilder-spec/0.16.74/android_rx2_client * * WARNING: not all features (notably unions) and data types work with android generator yet. * Android generator is designed to be used in an android application, but should work in any java codebase as long as you import jackson, retrofit2 and RxJava2 libraries. * If you are considering using this library, would like to request/discuss features, or would like to share how you're using it, please contact android-feedback@gilt.com * * Metadata about one of the types that is part of a union type */ @JsonIgnoreProperties( ignoreUnknown = true ) public class UnionType { private final String type; private final String description; private final Deprecation deprecation; private final Field[] fields; private final Attribute[] attributes; private final Boolean default_; private final String discriminatorValue; @JsonCreator public UnionType(@JsonProperty("type") String type, @JsonProperty("description") String description, @JsonProperty("deprecation") Deprecation deprecation, @JsonProperty("fields") Field[] fields, @JsonProperty("attributes") Attribute[] attributes, @JsonProperty("default") Boolean default_, @JsonProperty("discriminator_value") String discriminatorValue) { this.type = type; this.description = description; this.deprecation = deprecation; this.fields = fields; this.attributes = attributes; this.default_ = default_; this.discriminatorValue = discriminatorValue; } /** * The name of a type (a primitive, model name, or enum name) that makes up this union type */ public String getType() { return type; } public String getDescription() { return description; } public Deprecation getDeprecation() { return deprecation; } public Field[] getFields() { return fields; } public Attribute[] getAttributes() { return attributes; } /** * If true, indicates that this type should be used as the default when deserializing union types. This field is only used by union types that require a discriminator and sets the default value for that discriminator during deserialization. */ public Boolean getDefault() { return default_; } /** * The discriminator value defines the string to use in the discriminator field to identify this type. If not specified, the discriminator value will default to the name of the type itself. */ public String getDiscriminatorValue() { return discriminatorValue; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UnionType that = (UnionType) o; if (type != null ? !type.equals(that.type) : that.type != null) return false; if (description != null ? !description.equals(that.description) : that.description != null) return false; if (deprecation != null ? !deprecation.equals(that.deprecation) : that.deprecation != null) return false; if (!Arrays.equals(fields, that.fields)) return false; if (!Arrays.equals(attributes, that.attributes)) return false; if (default_ != null ? !default_.equals(that.default_) : that.default_ != null) return false; if (discriminatorValue != null ? !discriminatorValue.equals(that.discriminatorValue) : that.discriminatorValue != null) return false; return true; } @Override public int hashCode() { int result = 0; result = 31 * result + (type != null ? type.hashCode() : 0); result = 31 * result + (description != null ? description.hashCode() : 0); result = 31 * result + (deprecation != null ? deprecation.hashCode() : 0); result = 31 * result + (fields != null ? fields.hashCode() : 0); result = 31 * result + (attributes != null ? attributes.hashCode() : 0); result = 31 * result + (default_ != null ? default_.hashCode() : 0); result = 31 * result + (discriminatorValue != null ? discriminatorValue.hashCode() : 0); return result; } public String toJsonString() throws JsonProcessingException { return io.apibuilder.spec.v0.android.ApiBuilderObjectMapper.getInstance().writeValueAsString(this); } public static UnionType parseJson(String json) throws IOException { return io.apibuilder.spec.v0.android.ApiBuilderObjectMapper.getInstance().readValue( json, UnionType.class); } }