software.amazon.awssdk.services.apigateway.model.SdkType Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of api-gateway Show documentation
Show all versions of api-gateway Show documentation
The AWS Java SDK for Amazon API Gateway module holds the client classes that are used for communicating
with Amazon API
Gateway
/*
* 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.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.apigateway.transform.SdkTypeMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A type of SDK that API Gateway can generate.
*
*/
@Generated("software.amazon.awssdk:codegen")
public class SdkType implements StructuredPojo, ToCopyableBuilder {
private final String id;
private final String friendlyName;
private final String description;
private final List configurationProperties;
private SdkType(BuilderImpl builder) {
this.id = builder.id;
this.friendlyName = builder.friendlyName;
this.description = builder.description;
this.configurationProperties = builder.configurationProperties;
}
/**
*
* The identifier of an SdkType instance.
*
*
* @return The identifier of an SdkType instance.
*/
public String id() {
return id;
}
/**
*
* The user-friendly name of an SdkType instance.
*
*
* @return The user-friendly name of an SdkType instance.
*/
public String friendlyName() {
return friendlyName;
}
/**
*
* The description of an SdkType.
*
*
* @return The description of an SdkType.
*/
public String description() {
return description;
}
/**
*
* A list of configuration properties of an SdkType.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of configuration properties of an SdkType.
*/
public List configurationProperties() {
return configurationProperties;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(friendlyName());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(configurationProperties());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SdkType)) {
return false;
}
SdkType other = (SdkType) obj;
return Objects.equals(id(), other.id()) && Objects.equals(friendlyName(), other.friendlyName())
&& Objects.equals(description(), other.description())
&& Objects.equals(configurationProperties(), other.configurationProperties());
}
@Override
public String toString() {
return ToString.builder("SdkType").add("Id", id()).add("FriendlyName", friendlyName()).add("Description", description())
.add("ConfigurationProperties", configurationProperties()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.of(clazz.cast(id()));
case "friendlyName":
return Optional.of(clazz.cast(friendlyName()));
case "description":
return Optional.of(clazz.cast(description()));
case "configurationProperties":
return Optional.of(clazz.cast(configurationProperties()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
SdkTypeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* The identifier of an SdkType instance.
*
*
* @param id
* The identifier of an SdkType instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The user-friendly name of an SdkType instance.
*
*
* @param friendlyName
* The user-friendly name of an SdkType instance.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder friendlyName(String friendlyName);
/**
*
* The description of an SdkType.
*
*
* @param description
* The description of an SdkType.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* A list of configuration properties of an SdkType.
*
*
* @param configurationProperties
* A list of configuration properties of an SdkType.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder configurationProperties(Collection configurationProperties);
/**
*
* A list of configuration properties of an SdkType.
*
*
* @param configurationProperties
* A list of configuration properties of an SdkType.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder configurationProperties(SdkConfigurationProperty... configurationProperties);
}
static final class BuilderImpl implements Builder {
private String id;
private String friendlyName;
private String description;
private List configurationProperties;
private BuilderImpl() {
}
private BuilderImpl(SdkType model) {
id(model.id);
friendlyName(model.friendlyName);
description(model.description);
configurationProperties(model.configurationProperties);
}
public final String getId() {
return id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final void setId(String id) {
this.id = id;
}
public final String getFriendlyName() {
return friendlyName;
}
@Override
public final Builder friendlyName(String friendlyName) {
this.friendlyName = friendlyName;
return this;
}
public final void setFriendlyName(String friendlyName) {
this.friendlyName = friendlyName;
}
public final String getDescription() {
return description;
}
@Override
public final Builder description(String description) {
this.description = description;
return this;
}
public final void setDescription(String description) {
this.description = description;
}
public final Collection getConfigurationProperties() {
return configurationProperties != null ? configurationProperties.stream().map(SdkConfigurationProperty::toBuilder)
.collect(Collectors.toList()) : null;
}
@Override
public final Builder configurationProperties(Collection configurationProperties) {
this.configurationProperties = ListOfSdkConfigurationPropertyCopier.copy(configurationProperties);
return this;
}
@Override
@SafeVarargs
public final Builder configurationProperties(SdkConfigurationProperty... configurationProperties) {
configurationProperties(Arrays.asList(configurationProperties));
return this;
}
public final void setConfigurationProperties(Collection configurationProperties) {
this.configurationProperties = ListOfSdkConfigurationPropertyCopier.copyFromBuilder(configurationProperties);
}
@Override
public SdkType build() {
return new SdkType(this);
}
}
}