software.amazon.awssdk.services.connect.model.Condition 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;
/**
*
* A leaf node condition which can be used to specify a ProficiencyName, ProficiencyValue and ProficiencyLimit.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Condition implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField STRING_CONDITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("StringCondition")
.getter(getter(Condition::stringCondition)).setter(setter(Builder::stringCondition))
.constructor(StringCondition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StringCondition").build()).build();
private static final SdkField NUMBER_CONDITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("NumberCondition")
.getter(getter(Condition::numberCondition)).setter(setter(Builder::numberCondition))
.constructor(NumberCondition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NumberCondition").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(STRING_CONDITION_FIELD,
NUMBER_CONDITION_FIELD));
private static final long serialVersionUID = 1L;
private final StringCondition stringCondition;
private final NumberCondition numberCondition;
private Condition(BuilderImpl builder) {
this.stringCondition = builder.stringCondition;
this.numberCondition = builder.numberCondition;
}
/**
*
* A leaf node condition which can be used to specify a string condition.
*
*
*
* The currently supported values for FieldName
are name
and
value
.
*
*
*
* @return A leaf node condition which can be used to specify a string condition.
*
* The currently supported values for FieldName
are name
and
* value
.
*
*/
public final StringCondition stringCondition() {
return stringCondition;
}
/**
*
* A leaf node condition which can be used to specify a numeric condition.
*
*
* @return A leaf node condition which can be used to specify a numeric condition.
*/
public final NumberCondition numberCondition() {
return numberCondition;
}
@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(stringCondition());
hashCode = 31 * hashCode + Objects.hashCode(numberCondition());
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 Condition)) {
return false;
}
Condition other = (Condition) obj;
return Objects.equals(stringCondition(), other.stringCondition())
&& Objects.equals(numberCondition(), other.numberCondition());
}
/**
* 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("Condition").add("StringCondition", stringCondition()).add("NumberCondition", numberCondition())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "StringCondition":
return Optional.ofNullable(clazz.cast(stringCondition()));
case "NumberCondition":
return Optional.ofNullable(clazz.cast(numberCondition()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function