RequestBody.java
package io.swagger.v3.oas.models.parameters;
import io.swagger.v3.oas.models.annotations.OpenAPI31;
import io.swagger.v3.oas.models.media.Content;
/**
* Describes a single request body.
* @see <a href="https://github.com/OAI/OpenAPI-Specification/blob/3.0.4/versions/3.0.4.md#request-body-object">RequestBody (OpenAPI 3.0 specification)</a>
* @see <a href="https://github.com/OAI/OpenAPI-Specification/blob/3.1.1/versions/3.1.1.md#request-body-object">RequestBody (OpenAPI 3.1 specification)</a>
*/
public class RequestBody {
private String description = null;
private Content content = null;
private Boolean required = null;
private java.util.Map<String, Object> extensions = null;
private String $ref = null;
/**
* returns the description property from a RequestBody instance.
*
* @return String description
**/
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public RequestBody description(String description) {
this.description = description;
return this;
}
/**
* returns the content property from a RequestBody instance.
*
* @return Content content
**/
public Content getContent() {
return content;
}
public void setContent(Content content) {
this.content = content;
}
public RequestBody content(Content content) {
this.content = content;
return this;
}
/**
* returns the required property from a RequestBody instance.
*
* @return Boolean required
**/
public Boolean getRequired() {
return required;
}
public void setRequired(Boolean required) {
this.required = required;
}
public RequestBody required(Boolean required) {
this.required = required;
return this;
}
public java.util.Map<String, Object> getExtensions() {
return extensions;
}
public void addExtension(String name, Object value) {
if (name == null || name.isEmpty() || !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 void setExtensions(java.util.Map<String, Object> extensions) {
this.extensions = extensions;
}
public RequestBody extensions(java.util.Map<String, Object> extensions) {
this.extensions = extensions;
return this;
}
public String get$ref() {
return $ref;
}
public void set$ref(String $ref) {
if ($ref != null && ($ref.indexOf('.') == -1 && $ref.indexOf('/') == -1)) {
$ref = "#/components/requestBodies/" + $ref;
}
this.$ref = $ref;
}
public RequestBody $ref(String $ref) {
set$ref($ref);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof RequestBody)) {
return false;
}
RequestBody that = (RequestBody) o;
if (description != null ? !description.equals(that.description) : that.description != null) {
return false;
}
if (content != null ? !content.equals(that.content) : that.content != null) {
return false;
}
if (required != null ? !required.equals(that.required) : that.required != null) {
return false;
}
if (extensions != null ? !extensions.equals(that.extensions) : that.extensions != null) {
return false;
}
return $ref != null ? $ref.equals(that.$ref) : that.$ref == null;
}
@Override
public int hashCode() {
int result = description != null ? description.hashCode() : 0;
result = 31 * result + (content != null ? content.hashCode() : 0);
result = 31 * result + (required != null ? required.hashCode() : 0);
result = 31 * result + (extensions != null ? extensions.hashCode() : 0);
result = 31 * result + ($ref != null ? $ref.hashCode() : 0);
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class RequestBody {\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" content: ").append(toIndentedString(content)).append("\n");
sb.append(" required: ").append(toIndentedString(required)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}