software.amazon.awssdk.services.connect.model.HierarchyStructure Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of connect Show documentation
Show all versions of connect Show documentation
The AWS Java SDK for Connect module holds the client classes that are used for
communicating with Connect.
/*
* 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.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;
/**
*
* Contains information about a hierarchy structure.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class HierarchyStructure implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField LEVEL_ONE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LevelOne").getter(getter(HierarchyStructure::levelOne)).setter(setter(Builder::levelOne))
.constructor(HierarchyLevel::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LevelOne").build()).build();
private static final SdkField LEVEL_TWO_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LevelTwo").getter(getter(HierarchyStructure::levelTwo)).setter(setter(Builder::levelTwo))
.constructor(HierarchyLevel::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LevelTwo").build()).build();
private static final SdkField LEVEL_THREE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LevelThree").getter(getter(HierarchyStructure::levelThree)).setter(setter(Builder::levelThree))
.constructor(HierarchyLevel::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LevelThree").build()).build();
private static final SdkField LEVEL_FOUR_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LevelFour").getter(getter(HierarchyStructure::levelFour)).setter(setter(Builder::levelFour))
.constructor(HierarchyLevel::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LevelFour").build()).build();
private static final SdkField LEVEL_FIVE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("LevelFive").getter(getter(HierarchyStructure::levelFive)).setter(setter(Builder::levelFive))
.constructor(HierarchyLevel::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LevelFive").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LEVEL_ONE_FIELD,
LEVEL_TWO_FIELD, LEVEL_THREE_FIELD, LEVEL_FOUR_FIELD, LEVEL_FIVE_FIELD));
private static final long serialVersionUID = 1L;
private final HierarchyLevel levelOne;
private final HierarchyLevel levelTwo;
private final HierarchyLevel levelThree;
private final HierarchyLevel levelFour;
private final HierarchyLevel levelFive;
private HierarchyStructure(BuilderImpl builder) {
this.levelOne = builder.levelOne;
this.levelTwo = builder.levelTwo;
this.levelThree = builder.levelThree;
this.levelFour = builder.levelFour;
this.levelFive = builder.levelFive;
}
/**
*
* Information about level one.
*
*
* @return Information about level one.
*/
public final HierarchyLevel levelOne() {
return levelOne;
}
/**
*
* Information about level two.
*
*
* @return Information about level two.
*/
public final HierarchyLevel levelTwo() {
return levelTwo;
}
/**
*
* Information about level three.
*
*
* @return Information about level three.
*/
public final HierarchyLevel levelThree() {
return levelThree;
}
/**
*
* Information about level four.
*
*
* @return Information about level four.
*/
public final HierarchyLevel levelFour() {
return levelFour;
}
/**
*
* Information about level five.
*
*
* @return Information about level five.
*/
public final HierarchyLevel levelFive() {
return levelFive;
}
@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(levelOne());
hashCode = 31 * hashCode + Objects.hashCode(levelTwo());
hashCode = 31 * hashCode + Objects.hashCode(levelThree());
hashCode = 31 * hashCode + Objects.hashCode(levelFour());
hashCode = 31 * hashCode + Objects.hashCode(levelFive());
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 HierarchyStructure)) {
return false;
}
HierarchyStructure other = (HierarchyStructure) obj;
return Objects.equals(levelOne(), other.levelOne()) && Objects.equals(levelTwo(), other.levelTwo())
&& Objects.equals(levelThree(), other.levelThree()) && Objects.equals(levelFour(), other.levelFour())
&& Objects.equals(levelFive(), other.levelFive());
}
/**
* 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("HierarchyStructure").add("LevelOne", levelOne()).add("LevelTwo", levelTwo())
.add("LevelThree", levelThree()).add("LevelFour", levelFour()).add("LevelFive", levelFive()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LevelOne":
return Optional.ofNullable(clazz.cast(levelOne()));
case "LevelTwo":
return Optional.ofNullable(clazz.cast(levelTwo()));
case "LevelThree":
return Optional.ofNullable(clazz.cast(levelThree()));
case "LevelFour":
return Optional.ofNullable(clazz.cast(levelFour()));
case "LevelFive":
return Optional.ofNullable(clazz.cast(levelFive()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function