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

software.amazon.awssdk.services.chimesdkmediapipelines.model.KeywordMatchConfiguration 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.chimesdkmediapipelines.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 contains the settings for a keyword match task. *

*/ @Generated("software.amazon.awssdk:codegen") public final class KeywordMatchConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField RULE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RuleName").getter(getter(KeywordMatchConfiguration::ruleName)).setter(setter(Builder::ruleName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RuleName").build()).build(); private static final SdkField> KEYWORDS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Keywords") .getter(getter(KeywordMatchConfiguration::keywords)) .setter(setter(Builder::keywords)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Keywords").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 NEGATE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("Negate").getter(getter(KeywordMatchConfiguration::negate)).setter(setter(Builder::negate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Negate").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(RULE_NAME_FIELD, KEYWORDS_FIELD, NEGATE_FIELD)); private static final long serialVersionUID = 1L; private final String ruleName; private final List keywords; private final Boolean negate; private KeywordMatchConfiguration(BuilderImpl builder) { this.ruleName = builder.ruleName; this.keywords = builder.keywords; this.negate = builder.negate; } /** *

* The name of the keyword match rule. *

* * @return The name of the keyword match rule. */ public final String ruleName() { return ruleName; } /** * For responses, this returns true if the service returned a value for the Keywords 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 hasKeywords() { return keywords != null && !(keywords instanceof SdkAutoConstructList); } /** *

* The keywords or phrases that you want to match. *

*

* 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 #hasKeywords} method. *

* * @return The keywords or phrases that you want to match. */ public final List keywords() { return keywords; } /** *

* Matches keywords or phrases on their presence or absence. If set to TRUE, the rule matches when all * the specified keywords or phrases are absent. Default: FALSE. *

* * @return Matches keywords or phrases on their presence or absence. If set to TRUE, the rule matches * when all the specified keywords or phrases are absent. Default: FALSE. */ public final Boolean negate() { return negate; } @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(ruleName()); hashCode = 31 * hashCode + Objects.hashCode(hasKeywords() ? keywords() : null); hashCode = 31 * hashCode + Objects.hashCode(negate()); 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 KeywordMatchConfiguration)) { return false; } KeywordMatchConfiguration other = (KeywordMatchConfiguration) obj; return Objects.equals(ruleName(), other.ruleName()) && hasKeywords() == other.hasKeywords() && Objects.equals(keywords(), other.keywords()) && Objects.equals(negate(), other.negate()); } /** * 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("KeywordMatchConfiguration").add("RuleName", ruleName()) .add("Keywords", hasKeywords() ? keywords() : null).add("Negate", negate()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "RuleName": return Optional.ofNullable(clazz.cast(ruleName())); case "Keywords": return Optional.ofNullable(clazz.cast(keywords())); case "Negate": return Optional.ofNullable(clazz.cast(negate())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((KeywordMatchConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the keyword match rule. *

* * @param ruleName * The name of the keyword match rule. * @return Returns a reference to this object so that method calls can be chained together. */ Builder ruleName(String ruleName); /** *

* The keywords or phrases that you want to match. *

* * @param keywords * The keywords or phrases that you want to match. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keywords(Collection keywords); /** *

* The keywords or phrases that you want to match. *

* * @param keywords * The keywords or phrases that you want to match. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keywords(String... keywords); /** *

* Matches keywords or phrases on their presence or absence. If set to TRUE, the rule matches when * all the specified keywords or phrases are absent. Default: FALSE. *

* * @param negate * Matches keywords or phrases on their presence or absence. If set to TRUE, the rule * matches when all the specified keywords or phrases are absent. Default: FALSE. * @return Returns a reference to this object so that method calls can be chained together. */ Builder negate(Boolean negate); } static final class BuilderImpl implements Builder { private String ruleName; private List keywords = DefaultSdkAutoConstructList.getInstance(); private Boolean negate; private BuilderImpl() { } private BuilderImpl(KeywordMatchConfiguration model) { ruleName(model.ruleName); keywords(model.keywords); negate(model.negate); } public final String getRuleName() { return ruleName; } public final void setRuleName(String ruleName) { this.ruleName = ruleName; } @Override public final Builder ruleName(String ruleName) { this.ruleName = ruleName; return this; } public final Collection getKeywords() { if (keywords instanceof SdkAutoConstructList) { return null; } return keywords; } public final void setKeywords(Collection keywords) { this.keywords = KeywordMatchWordListCopier.copy(keywords); } @Override public final Builder keywords(Collection keywords) { this.keywords = KeywordMatchWordListCopier.copy(keywords); return this; } @Override @SafeVarargs public final Builder keywords(String... keywords) { keywords(Arrays.asList(keywords)); return this; } public final Boolean getNegate() { return negate; } public final void setNegate(Boolean negate) { this.negate = negate; } @Override public final Builder negate(Boolean negate) { this.negate = negate; return this; } @Override public KeywordMatchConfiguration build() { return new KeywordMatchConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy