software.amazon.awssdk.services.ecr.model.DescribeRepositoriesResponse Maven / Gradle / Ivy
Show all versions of ecr Show documentation
/*
* Copyright 2012-2017 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.ecr.model;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.Generated;
import software.amazon.awssdk.core.AmazonWebServiceResult;
import software.amazon.awssdk.core.ResponseMetadata;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public class DescribeRepositoriesResponse extends AmazonWebServiceResult implements
ToCopyableBuilder {
private final List repositories;
private final String nextToken;
private DescribeRepositoriesResponse(BuilderImpl builder) {
this.repositories = builder.repositories;
this.nextToken = builder.nextToken;
}
/**
*
* A list of repository objects corresponding to valid repositories.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* @return A list of repository objects corresponding to valid repositories.
*/
public List repositories() {
return repositories;
}
/**
*
* The nextToken
value to include in a future DescribeRepositories
request. When the
* results of a DescribeRepositories
request exceed maxResults
, this value can be used to
* retrieve the next page of results. This value is null
when there are no more results to return.
*
*
* @return The nextToken
value to include in a future DescribeRepositories
request. When
* the results of a DescribeRepositories
request exceed maxResults
, this value can
* be used to retrieve the next page of results. This value is null
when there are no more
* results to return.
*/
public String nextToken() {
return nextToken;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + ((repositories() == null) ? 0 : repositories().hashCode());
hashCode = 31 * hashCode + ((nextToken() == null) ? 0 : nextToken().hashCode());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeRepositoriesResponse)) {
return false;
}
DescribeRepositoriesResponse other = (DescribeRepositoriesResponse) obj;
if (other.repositories() == null ^ this.repositories() == null) {
return false;
}
if (other.repositories() != null && !other.repositories().equals(this.repositories())) {
return false;
}
if (other.nextToken() == null ^ this.nextToken() == null) {
return false;
}
if (other.nextToken() != null && !other.nextToken().equals(this.nextToken())) {
return false;
}
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("{");
if (repositories() != null) {
sb.append("Repositories: ").append(repositories()).append(",");
}
if (nextToken() != null) {
sb.append("NextToken: ").append(nextToken()).append(",");
}
if (sb.length() > 1) {
sb.setLength(sb.length() - 1);
}
sb.append("}");
return sb.toString();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "repositories":
return Optional.of(clazz.cast(repositories()));
case "nextToken":
return Optional.of(clazz.cast(nextToken()));
default:
return Optional.empty();
}
}
public interface Builder extends CopyableBuilder {
/**
*
* A list of repository objects corresponding to valid repositories.
*
*
* @param repositories
* A list of repository objects corresponding to valid repositories.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder repositories(Collection repositories);
/**
*
* A list of repository objects corresponding to valid repositories.
*
*
* @param repositories
* A list of repository objects corresponding to valid repositories.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder repositories(Repository... repositories);
/**
*
* The nextToken
value to include in a future DescribeRepositories
request. When the
* results of a DescribeRepositories
request exceed maxResults
, this value can be used
* to retrieve the next page of results. This value is null
when there are no more results to
* return.
*
*
* @param nextToken
* The nextToken
value to include in a future DescribeRepositories
request.
* When the results of a DescribeRepositories
request exceed maxResults
, this
* value can be used to retrieve the next page of results. This value is null
when there are
* no more results to return.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder nextToken(String nextToken);
}
static final class BuilderImpl implements Builder {
private List repositories;
private String nextToken;
private BuilderImpl() {
}
private BuilderImpl(DescribeRepositoriesResponse model) {
repositories(model.repositories);
nextToken(model.nextToken);
}
public final Collection getRepositories() {
return repositories != null ? repositories.stream().map(Repository::toBuilder).collect(Collectors.toList()) : null;
}
@Override
public final Builder repositories(Collection repositories) {
this.repositories = RepositoryListCopier.copy(repositories);
return this;
}
@Override
@SafeVarargs
public final Builder repositories(Repository... repositories) {
repositories(Arrays.asList(repositories));
return this;
}
public final void setRepositories(Collection repositories) {
this.repositories = RepositoryListCopier.copyFromBuilder(repositories);
}
public final String getNextToken() {
return nextToken;
}
@Override
public final Builder nextToken(String nextToken) {
this.nextToken = nextToken;
return this;
}
public final void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
@Override
public DescribeRepositoriesResponse build() {
return new DescribeRepositoriesResponse(this);
}
}
}