software.amazon.awssdk.services.codegurureviewer.model.Repository Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codegurureviewer Show documentation
Show all versions of codegurureviewer Show documentation
The AWS Java SDK for CodeGuru Reviewer module holds the client classes that are used for
communicating with CodeGuru Reviewer.
/*
* Copyright 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.codegurureviewer.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Information about an associated Amazon Web Services CodeCommit repository or an associated repository that is managed
* by Amazon Web Services CodeStar Connections (for example, Bitbucket). This Repository
object is not used
* if your source code is in an associated GitHub repository.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Repository implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField CODE_COMMIT_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("CodeCommit")
.getter(getter(Repository::codeCommit)).setter(setter(Builder::codeCommit))
.constructor(CodeCommitRepository::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CodeCommit").build()).build();
private static final SdkField BITBUCKET_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Bitbucket")
.getter(getter(Repository::bitbucket)).setter(setter(Builder::bitbucket))
.constructor(ThirdPartySourceRepository::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bitbucket").build()).build();
private static final SdkField GIT_HUB_ENTERPRISE_SERVER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("GitHubEnterpriseServer")
.getter(getter(Repository::gitHubEnterpriseServer)).setter(setter(Builder::gitHubEnterpriseServer))
.constructor(ThirdPartySourceRepository::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("GitHubEnterpriseServer").build())
.build();
private static final SdkField S3_BUCKET_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("S3Bucket").getter(getter(Repository::s3Bucket)).setter(setter(Builder::s3Bucket))
.constructor(S3Repository::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("S3Bucket").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CODE_COMMIT_FIELD,
BITBUCKET_FIELD, GIT_HUB_ENTERPRISE_SERVER_FIELD, S3_BUCKET_FIELD));
private static final long serialVersionUID = 1L;
private final CodeCommitRepository codeCommit;
private final ThirdPartySourceRepository bitbucket;
private final ThirdPartySourceRepository gitHubEnterpriseServer;
private final S3Repository s3Bucket;
private Repository(BuilderImpl builder) {
this.codeCommit = builder.codeCommit;
this.bitbucket = builder.bitbucket;
this.gitHubEnterpriseServer = builder.gitHubEnterpriseServer;
this.s3Bucket = builder.s3Bucket;
}
/**
*
* Information about an Amazon Web Services CodeCommit repository.
*
*
* @return Information about an Amazon Web Services CodeCommit repository.
*/
public final CodeCommitRepository codeCommit() {
return codeCommit;
}
/**
*
* Information about a Bitbucket repository.
*
*
* @return Information about a Bitbucket repository.
*/
public final ThirdPartySourceRepository bitbucket() {
return bitbucket;
}
/**
*
* Information about a GitHub Enterprise Server repository.
*
*
* @return Information about a GitHub Enterprise Server repository.
*/
public final ThirdPartySourceRepository gitHubEnterpriseServer() {
return gitHubEnterpriseServer;
}
/**
* Returns the value of the S3Bucket property for this object.
*
* @return The value of the S3Bucket property for this object.
*/
public final S3Repository s3Bucket() {
return s3Bucket;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(codeCommit());
hashCode = 31 * hashCode + Objects.hashCode(bitbucket());
hashCode = 31 * hashCode + Objects.hashCode(gitHubEnterpriseServer());
hashCode = 31 * hashCode + Objects.hashCode(s3Bucket());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Repository)) {
return false;
}
Repository other = (Repository) obj;
return Objects.equals(codeCommit(), other.codeCommit()) && Objects.equals(bitbucket(), other.bitbucket())
&& Objects.equals(gitHubEnterpriseServer(), other.gitHubEnterpriseServer())
&& Objects.equals(s3Bucket(), other.s3Bucket());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("Repository").add("CodeCommit", codeCommit()).add("Bitbucket", bitbucket())
.add("GitHubEnterpriseServer", gitHubEnterpriseServer()).add("S3Bucket", s3Bucket()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CodeCommit":
return Optional.ofNullable(clazz.cast(codeCommit()));
case "Bitbucket":
return Optional.ofNullable(clazz.cast(bitbucket()));
case "GitHubEnterpriseServer":
return Optional.ofNullable(clazz.cast(gitHubEnterpriseServer()));
case "S3Bucket":
return Optional.ofNullable(clazz.cast(s3Bucket()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function