software.amazon.awssdk.services.cloudsearch.model.TextArrayOptions 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.cloudsearch.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.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;
/**
*
* Options for a field that contains an array of text strings. Present if IndexFieldType
specifies the
* field is of type text-array
. A text-array
field is always searchable. All options are
* enabled by default.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TextArrayOptions implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DefaultValue").getter(getter(TextArrayOptions::defaultValue)).setter(setter(Builder::defaultValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DefaultValue").build()).build();
private static final SdkField SOURCE_FIELDS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SourceFields").getter(getter(TextArrayOptions::sourceFields)).setter(setter(Builder::sourceFields))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceFields").build()).build();
private static final SdkField RETURN_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("ReturnEnabled").getter(getter(TextArrayOptions::returnEnabled)).setter(setter(Builder::returnEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnEnabled").build()).build();
private static final SdkField HIGHLIGHT_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("HighlightEnabled").getter(getter(TextArrayOptions::highlightEnabled))
.setter(setter(Builder::highlightEnabled))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HighlightEnabled").build()).build();
private static final SdkField ANALYSIS_SCHEME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AnalysisScheme").getter(getter(TextArrayOptions::analysisScheme))
.setter(setter(Builder::analysisScheme))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AnalysisScheme").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEFAULT_VALUE_FIELD,
SOURCE_FIELDS_FIELD, RETURN_ENABLED_FIELD, HIGHLIGHT_ENABLED_FIELD, ANALYSIS_SCHEME_FIELD));
private static final long serialVersionUID = 1L;
private final String defaultValue;
private final String sourceFields;
private final Boolean returnEnabled;
private final Boolean highlightEnabled;
private final String analysisScheme;
private TextArrayOptions(BuilderImpl builder) {
this.defaultValue = builder.defaultValue;
this.sourceFields = builder.sourceFields;
this.returnEnabled = builder.returnEnabled;
this.highlightEnabled = builder.highlightEnabled;
this.analysisScheme = builder.analysisScheme;
}
/**
* A value to use for the field if the field isn't specified for a document.
*
* @return A value to use for the field if the field isn't specified for a document.
*/
public final String defaultValue() {
return defaultValue;
}
/**
*
* A list of source fields to map to the field.
*
*
* @return A list of source fields to map to the field.
*/
public final String sourceFields() {
return sourceFields;
}
/**
*
* Whether the contents of the field can be returned in the search results.
*
*
* @return Whether the contents of the field can be returned in the search results.
*/
public final Boolean returnEnabled() {
return returnEnabled;
}
/**
*
* Whether highlights can be returned for the field.
*
*
* @return Whether highlights can be returned for the field.
*/
public final Boolean highlightEnabled() {
return highlightEnabled;
}
/**
*
* The name of an analysis scheme for a text-array
field.
*
*
* @return The name of an analysis scheme for a text-array
field.
*/
public final String analysisScheme() {
return analysisScheme;
}
@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(defaultValue());
hashCode = 31 * hashCode + Objects.hashCode(sourceFields());
hashCode = 31 * hashCode + Objects.hashCode(returnEnabled());
hashCode = 31 * hashCode + Objects.hashCode(highlightEnabled());
hashCode = 31 * hashCode + Objects.hashCode(analysisScheme());
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 TextArrayOptions)) {
return false;
}
TextArrayOptions other = (TextArrayOptions) obj;
return Objects.equals(defaultValue(), other.defaultValue()) && Objects.equals(sourceFields(), other.sourceFields())
&& Objects.equals(returnEnabled(), other.returnEnabled())
&& Objects.equals(highlightEnabled(), other.highlightEnabled())
&& Objects.equals(analysisScheme(), other.analysisScheme());
}
/**
* 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("TextArrayOptions").add("DefaultValue", defaultValue()).add("SourceFields", sourceFields())
.add("ReturnEnabled", returnEnabled()).add("HighlightEnabled", highlightEnabled())
.add("AnalysisScheme", analysisScheme()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DefaultValue":
return Optional.ofNullable(clazz.cast(defaultValue()));
case "SourceFields":
return Optional.ofNullable(clazz.cast(sourceFields()));
case "ReturnEnabled":
return Optional.ofNullable(clazz.cast(returnEnabled()));
case "HighlightEnabled":
return Optional.ofNullable(clazz.cast(highlightEnabled()));
case "AnalysisScheme":
return Optional.ofNullable(clazz.cast(analysisScheme()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy