software.amazon.awssdk.services.apigateway.model.GetExportResponse Maven / Gradle / Ivy
Show all versions of api-gateway Show documentation
/*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.apigateway.model;
import java.nio.ByteBuffer;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Generated;
import software.amazon.awssdk.core.runtime.StandardMemberCopier;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The binary blob response to GetExport, which contains the generated SDK.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class GetExportResponse extends APIGatewayResponse implements
ToCopyableBuilder {
private final String contentType;
private final String contentDisposition;
private final ByteBuffer body;
private GetExportResponse(BuilderImpl builder) {
super(builder);
this.contentType = builder.contentType;
this.contentDisposition = builder.contentDisposition;
this.body = builder.body;
}
/**
*
* The content-type header value in the HTTP response. This will correspond to a valid 'accept' type in the request.
*
*
* @return The content-type header value in the HTTP response. This will correspond to a valid 'accept' type in the
* request.
*/
public String contentType() {
return contentType;
}
/**
*
* The content-disposition header value in the HTTP response.
*
*
* @return The content-disposition header value in the HTTP response.
*/
public String contentDisposition() {
return contentDisposition;
}
/**
*
* The binary blob response to GetExport, which contains the export.
*
*
* This method will return a new read-only {@code ByteBuffer} each time it is invoked.
*
*
* @return The binary blob response to GetExport, which contains the export.
*/
public ByteBuffer body() {
return body == null ? null : body.asReadOnlyBuffer();
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(contentType());
hashCode = 31 * hashCode + Objects.hashCode(contentDisposition());
hashCode = 31 * hashCode + Objects.hashCode(body());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetExportResponse)) {
return false;
}
GetExportResponse other = (GetExportResponse) obj;
return Objects.equals(contentType(), other.contentType())
&& Objects.equals(contentDisposition(), other.contentDisposition()) && Objects.equals(body(), other.body());
}
@Override
public String toString() {
return ToString.builder("GetExportResponse").add("ContentType", contentType())
.add("ContentDisposition", contentDisposition()).add("Body", body()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "contentType":
return Optional.of(clazz.cast(contentType()));
case "contentDisposition":
return Optional.of(clazz.cast(contentDisposition()));
case "body":
return Optional.of(clazz.cast(body()));
default:
return Optional.empty();
}
}
public interface Builder extends APIGatewayResponse.Builder, CopyableBuilder {
/**
*
* The content-type header value in the HTTP response. This will correspond to a valid 'accept' type in the
* request.
*
*
* @param contentType
* The content-type header value in the HTTP response. This will correspond to a valid 'accept' type in
* the request.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder contentType(String contentType);
/**
*
* The content-disposition header value in the HTTP response.
*
*
* @param contentDisposition
* The content-disposition header value in the HTTP response.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder contentDisposition(String contentDisposition);
/**
*
* The binary blob response to GetExport, which contains the export.
*
*
* To preserve immutability, the remaining bytes in the provided buffer will be copied into a new buffer when
* set.
*
*
* @param body
* The binary blob response to GetExport, which contains the export.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder body(ByteBuffer body);
}
static final class BuilderImpl extends APIGatewayResponse.BuilderImpl implements Builder {
private String contentType;
private String contentDisposition;
private ByteBuffer body;
private BuilderImpl() {
}
private BuilderImpl(GetExportResponse model) {
contentType(model.contentType);
contentDisposition(model.contentDisposition);
body(model.body);
}
public final String getContentType() {
return contentType;
}
@Override
public final Builder contentType(String contentType) {
this.contentType = contentType;
return this;
}
public final void setContentType(String contentType) {
this.contentType = contentType;
}
public final String getContentDisposition() {
return contentDisposition;
}
@Override
public final Builder contentDisposition(String contentDisposition) {
this.contentDisposition = contentDisposition;
return this;
}
public final void setContentDisposition(String contentDisposition) {
this.contentDisposition = contentDisposition;
}
public final ByteBuffer getBody() {
return body;
}
@Override
public final Builder body(ByteBuffer body) {
this.body = StandardMemberCopier.copy(body);
return this;
}
public final void setBody(ByteBuffer body) {
this.body = StandardMemberCopier.copy(body);
}
@Override
public GetExportResponse build() {
return new GetExportResponse(this);
}
}
}