
io.swagger.v3.oas.models.media.EncodingProperty Maven / Gradle / Ivy
package io.swagger.v3.oas.models.media;
import io.swagger.v3.oas.models.annotations.OpenAPI31;
import io.swagger.v3.oas.models.headers.Header;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
/**
* EncodingProperty
*
* @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#encodingPropertyObject"
*/
public class EncodingProperty {
private String contentType = null;
private Map headers = null;
private StyleEnum style = null;
private Boolean explode = null;
private Boolean allowReserved = null;
private Map extensions = null;
/**
* returns the contentType property from a EncodingProperty instance.
*
* @return String contentType
**/
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public EncodingProperty contentType(String contentType) {
this.contentType = contentType;
return this;
}
/**
* returns the headers property from a EncodingProperty instance.
*
* @return headers
**/
public Map getHeaders() {
return headers;
}
public void setHeaders(Map headers) {
this.headers = headers;
}
public EncodingProperty headers(Map headers) {
this.headers = headers;
return this;
}
public EncodingProperty addHeaderObject(String name, Header header) {
if (this.headers == null) {
headers = new LinkedHashMap<>();
}
headers.put(name, header);
return this;
}
/**
* returns the style property from a EncodingProperty instance.
*
* @return StyleEnum style
**/
public StyleEnum getStyle() {
return style;
}
public void setStyle(StyleEnum style) {
this.style = style;
}
public EncodingProperty style(StyleEnum style) {
this.style = style;
return this;
}
/**
* returns the explode property from a EncodingProperty instance.
*
* @return Boolean explode
**/
public Boolean getExplode() {
return explode;
}
public void setExplode(Boolean explode) {
this.explode = explode;
}
public EncodingProperty explode(Boolean explode) {
this.explode = explode;
return this;
}
/**
* returns the allowReserved property from a EncodingProperty instance.
*
* @return Boolean allowReserved
**/
public Boolean getAllowReserved() {
return allowReserved;
}
public void setAllowReserved(Boolean allowReserved) {
this.allowReserved = allowReserved;
}
public EncodingProperty allowReserved(Boolean allowReserved) {
this.allowReserved = allowReserved;
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
var encodingProperty = (EncodingProperty) o;
return Objects.equals(this.contentType, encodingProperty.contentType) &&
Objects.equals(this.headers, encodingProperty.headers) &&
Objects.equals(this.style, encodingProperty.style) &&
Objects.equals(this.explode, encodingProperty.explode) &&
Objects.equals(this.allowReserved, encodingProperty.allowReserved) &&
Objects.equals(this.extensions, encodingProperty.extensions);
}
@Override
public int hashCode() {
return Objects.hash(contentType, headers, style, explode, allowReserved, extensions);
}
public Map getExtensions() {
return extensions;
}
public void setExtensions(Map extensions) {
this.extensions = extensions;
}
public void addExtension(String name, Object value) {
if (name == null || !name.startsWith("x-")) {
return;
}
if (this.extensions == null) {
this.extensions = new java.util.LinkedHashMap<>();
}
this.extensions.put(name, value);
}
@OpenAPI31
public void addExtension31(String name, Object value) {
if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) {
return;
}
addExtension(name, value);
}
public EncodingProperty extensions(Map extensions) {
this.extensions = extensions;
return this;
}
@Override
public String toString() {
return "class EncodingProperty {\n" +
" contentType: " + toIndentedString(contentType) + "\n" +
" headers: " + toIndentedString(headers) + "\n" +
" style: " + toIndentedString(style) + "\n" +
" explode: " + toIndentedString(explode) + "\n" +
" allowReserved: " + toIndentedString(allowReserved) + "\n" +
"}";
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
/**
* Gets or Sets style
*/
public enum StyleEnum {
FORM("form"),
SPACEDELIMITED("spaceDelimited"),
PIPEDELIMITED("pipeDelimited"),
DEEPOBJECT("deepObject");
private final String value;
StyleEnum(String value) {
this.value = value;
}
@Override
public String toString() {
return value;
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy