All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.codestarconnections.model.SyncBlockerSummary Maven / Gradle / Ivy

/*
 * 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.codestarconnections.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A summary for sync blockers. *

*/ @Generated("software.amazon.awssdk:codegen") public final class SyncBlockerSummary implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField RESOURCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ResourceName").getter(getter(SyncBlockerSummary::resourceName)).setter(setter(Builder::resourceName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResourceName").build()).build(); private static final SdkField PARENT_RESOURCE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ParentResourceName").getter(getter(SyncBlockerSummary::parentResourceName)) .setter(setter(Builder::parentResourceName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParentResourceName").build()) .build(); private static final SdkField> LATEST_BLOCKERS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("LatestBlockers") .getter(getter(SyncBlockerSummary::latestBlockers)) .setter(setter(Builder::latestBlockers)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LatestBlockers").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(SyncBlocker::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RESOURCE_NAME_FIELD, PARENT_RESOURCE_NAME_FIELD, LATEST_BLOCKERS_FIELD)); private static final long serialVersionUID = 1L; private final String resourceName; private final String parentResourceName; private final List latestBlockers; private SyncBlockerSummary(BuilderImpl builder) { this.resourceName = builder.resourceName; this.parentResourceName = builder.parentResourceName; this.latestBlockers = builder.latestBlockers; } /** *

* The resource name for sync blocker summary. *

* * @return The resource name for sync blocker summary. */ public final String resourceName() { return resourceName; } /** *

* The parent resource name for a sync blocker summary. *

* * @return The parent resource name for a sync blocker summary. */ public final String parentResourceName() { return parentResourceName; } /** * For responses, this returns true if the service returned a value for the LatestBlockers property. This DOES NOT * check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). * This is useful because the SDK will never return a null collection or map, but you may need to differentiate * between the service returning nothing (or null) and the service returning an empty collection or map. For * requests, this returns true if a value for the property was specified in the request builder, and false if a * value was not specified. */ public final boolean hasLatestBlockers() { return latestBlockers != null && !(latestBlockers instanceof SdkAutoConstructList); } /** *

* The latest events for a sync blocker summary. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* This method will never return null. If you would like to know whether the service returned this field (so that * you can differentiate between null and empty), you can use the {@link #hasLatestBlockers} method. *

* * @return The latest events for a sync blocker summary. */ public final List latestBlockers() { return latestBlockers; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(resourceName()); hashCode = 31 * hashCode + Objects.hashCode(parentResourceName()); hashCode = 31 * hashCode + Objects.hashCode(hasLatestBlockers() ? latestBlockers() : null); 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 SyncBlockerSummary)) { return false; } SyncBlockerSummary other = (SyncBlockerSummary) obj; return Objects.equals(resourceName(), other.resourceName()) && Objects.equals(parentResourceName(), other.parentResourceName()) && hasLatestBlockers() == other.hasLatestBlockers() && Objects.equals(latestBlockers(), other.latestBlockers()); } /** * 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("SyncBlockerSummary").add("ResourceName", resourceName()) .add("ParentResourceName", parentResourceName()) .add("LatestBlockers", hasLatestBlockers() ? latestBlockers() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ResourceName": return Optional.ofNullable(clazz.cast(resourceName())); case "ParentResourceName": return Optional.ofNullable(clazz.cast(parentResourceName())); case "LatestBlockers": return Optional.ofNullable(clazz.cast(latestBlockers())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((SyncBlockerSummary) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The resource name for sync blocker summary. *

* * @param resourceName * The resource name for sync blocker summary. * @return Returns a reference to this object so that method calls can be chained together. */ Builder resourceName(String resourceName); /** *

* The parent resource name for a sync blocker summary. *

* * @param parentResourceName * The parent resource name for a sync blocker summary. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parentResourceName(String parentResourceName); /** *

* The latest events for a sync blocker summary. *

* * @param latestBlockers * The latest events for a sync blocker summary. * @return Returns a reference to this object so that method calls can be chained together. */ Builder latestBlockers(Collection latestBlockers); /** *

* The latest events for a sync blocker summary. *

* * @param latestBlockers * The latest events for a sync blocker summary. * @return Returns a reference to this object so that method calls can be chained together. */ Builder latestBlockers(SyncBlocker... latestBlockers); /** *

* The latest events for a sync blocker summary. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.codestarconnections.model.SyncBlocker.Builder} avoiding the need to * create one manually via * {@link software.amazon.awssdk.services.codestarconnections.model.SyncBlocker#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.codestarconnections.model.SyncBlocker.Builder#build()} is called * immediately and its result is passed to {@link #latestBlockers(List)}. * * @param latestBlockers * a consumer that will call methods on * {@link software.amazon.awssdk.services.codestarconnections.model.SyncBlocker.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #latestBlockers(java.util.Collection) */ Builder latestBlockers(Consumer... latestBlockers); } static final class BuilderImpl implements Builder { private String resourceName; private String parentResourceName; private List latestBlockers = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(SyncBlockerSummary model) { resourceName(model.resourceName); parentResourceName(model.parentResourceName); latestBlockers(model.latestBlockers); } public final String getResourceName() { return resourceName; } public final void setResourceName(String resourceName) { this.resourceName = resourceName; } @Override public final Builder resourceName(String resourceName) { this.resourceName = resourceName; return this; } public final String getParentResourceName() { return parentResourceName; } public final void setParentResourceName(String parentResourceName) { this.parentResourceName = parentResourceName; } @Override public final Builder parentResourceName(String parentResourceName) { this.parentResourceName = parentResourceName; return this; } public final List getLatestBlockers() { List result = LatestSyncBlockerListCopier.copyToBuilder(this.latestBlockers); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setLatestBlockers(Collection latestBlockers) { this.latestBlockers = LatestSyncBlockerListCopier.copyFromBuilder(latestBlockers); } @Override public final Builder latestBlockers(Collection latestBlockers) { this.latestBlockers = LatestSyncBlockerListCopier.copy(latestBlockers); return this; } @Override @SafeVarargs public final Builder latestBlockers(SyncBlocker... latestBlockers) { latestBlockers(Arrays.asList(latestBlockers)); return this; } @Override @SafeVarargs public final Builder latestBlockers(Consumer... latestBlockers) { latestBlockers(Stream.of(latestBlockers).map(c -> SyncBlocker.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } @Override public SyncBlockerSummary build() { return new SyncBlockerSummary(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy