software.amazon.awssdk.services.connect.model.AgentHierarchyGroups Maven / Gradle / Ivy
Show all versions of connect Show documentation
/*
* 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.connect.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.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.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 structure that defines search criteria for contacts using agent hierarchy group levels. For more information about
* agent hierarchies, see Set Up
* Agent Hierarchies in the Amazon Connect Administrator Guide.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AgentHierarchyGroups implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> L1_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("L1Ids")
.getter(getter(AgentHierarchyGroups::l1Ids))
.setter(setter(Builder::l1Ids))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("L1Ids").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> L2_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("L2Ids")
.getter(getter(AgentHierarchyGroups::l2Ids))
.setter(setter(Builder::l2Ids))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("L2Ids").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> L3_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("L3Ids")
.getter(getter(AgentHierarchyGroups::l3Ids))
.setter(setter(Builder::l3Ids))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("L3Ids").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> L4_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("L4Ids")
.getter(getter(AgentHierarchyGroups::l4Ids))
.setter(setter(Builder::l4Ids))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("L4Ids").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> L5_IDS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("L5Ids")
.getter(getter(AgentHierarchyGroups::l5Ids))
.setter(setter(Builder::l5Ids))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("L5Ids").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(L1_IDS_FIELD, L2_IDS_FIELD,
L3_IDS_FIELD, L4_IDS_FIELD, L5_IDS_FIELD));
private static final long serialVersionUID = 1L;
private final List l1Ids;
private final List l2Ids;
private final List l3Ids;
private final List l4Ids;
private final List l5Ids;
private AgentHierarchyGroups(BuilderImpl builder) {
this.l1Ids = builder.l1Ids;
this.l2Ids = builder.l2Ids;
this.l3Ids = builder.l3Ids;
this.l4Ids = builder.l4Ids;
this.l5Ids = builder.l5Ids;
}
/**
* For responses, this returns true if the service returned a value for the L1Ids 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 hasL1Ids() {
return l1Ids != null && !(l1Ids instanceof SdkAutoConstructList);
}
/**
*
* The identifiers for level 1 hierarchy groups.
*
*
* 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 #hasL1Ids} method.
*
*
* @return The identifiers for level 1 hierarchy groups.
*/
public final List l1Ids() {
return l1Ids;
}
/**
* For responses, this returns true if the service returned a value for the L2Ids 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 hasL2Ids() {
return l2Ids != null && !(l2Ids instanceof SdkAutoConstructList);
}
/**
*
* The identifiers for level 2 hierarchy groups.
*
*
* 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 #hasL2Ids} method.
*
*
* @return The identifiers for level 2 hierarchy groups.
*/
public final List l2Ids() {
return l2Ids;
}
/**
* For responses, this returns true if the service returned a value for the L3Ids 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 hasL3Ids() {
return l3Ids != null && !(l3Ids instanceof SdkAutoConstructList);
}
/**
*
* The identifiers for level 3 hierarchy groups.
*
*
* 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 #hasL3Ids} method.
*
*
* @return The identifiers for level 3 hierarchy groups.
*/
public final List l3Ids() {
return l3Ids;
}
/**
* For responses, this returns true if the service returned a value for the L4Ids 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 hasL4Ids() {
return l4Ids != null && !(l4Ids instanceof SdkAutoConstructList);
}
/**
*
* The identifiers for level 4 hierarchy groups.
*
*
* 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 #hasL4Ids} method.
*
*
* @return The identifiers for level 4 hierarchy groups.
*/
public final List l4Ids() {
return l4Ids;
}
/**
* For responses, this returns true if the service returned a value for the L5Ids 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 hasL5Ids() {
return l5Ids != null && !(l5Ids instanceof SdkAutoConstructList);
}
/**
*
* The identifiers for level 5 hierarchy groups.
*
*
* 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 #hasL5Ids} method.
*
*
* @return The identifiers for level 5 hierarchy groups.
*/
public final List l5Ids() {
return l5Ids;
}
@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(hasL1Ids() ? l1Ids() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasL2Ids() ? l2Ids() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasL3Ids() ? l3Ids() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasL4Ids() ? l4Ids() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasL5Ids() ? l5Ids() : 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 AgentHierarchyGroups)) {
return false;
}
AgentHierarchyGroups other = (AgentHierarchyGroups) obj;
return hasL1Ids() == other.hasL1Ids() && Objects.equals(l1Ids(), other.l1Ids()) && hasL2Ids() == other.hasL2Ids()
&& Objects.equals(l2Ids(), other.l2Ids()) && hasL3Ids() == other.hasL3Ids()
&& Objects.equals(l3Ids(), other.l3Ids()) && hasL4Ids() == other.hasL4Ids()
&& Objects.equals(l4Ids(), other.l4Ids()) && hasL5Ids() == other.hasL5Ids()
&& Objects.equals(l5Ids(), other.l5Ids());
}
/**
* 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("AgentHierarchyGroups").add("L1Ids", hasL1Ids() ? l1Ids() : null)
.add("L2Ids", hasL2Ids() ? l2Ids() : null).add("L3Ids", hasL3Ids() ? l3Ids() : null)
.add("L4Ids", hasL4Ids() ? l4Ids() : null).add("L5Ids", hasL5Ids() ? l5Ids() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "L1Ids":
return Optional.ofNullable(clazz.cast(l1Ids()));
case "L2Ids":
return Optional.ofNullable(clazz.cast(l2Ids()));
case "L3Ids":
return Optional.ofNullable(clazz.cast(l3Ids()));
case "L4Ids":
return Optional.ofNullable(clazz.cast(l4Ids()));
case "L5Ids":
return Optional.ofNullable(clazz.cast(l5Ids()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function