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

software.amazon.awssdk.services.cloudsearch.model.DateArrayOptions Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon CloudSearch module holds the client classes that are used for communicating with Amazon CloudSearch Service

There is a newer version: 2.29.15
Show newest version
/*
 * Copyright 2014-2019 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 dates. Present if IndexFieldType specifies the field is of * type date-array. All options are enabled by default. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DateArrayOptions implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DEFAULT_VALUE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(DateArrayOptions::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) .getter(getter(DateArrayOptions::sourceFields)).setter(setter(Builder::sourceFields)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceFields").build()).build(); private static final SdkField FACET_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(DateArrayOptions::facetEnabled)).setter(setter(Builder::facetEnabled)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FacetEnabled").build()).build(); private static final SdkField SEARCH_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(DateArrayOptions::searchEnabled)).setter(setter(Builder::searchEnabled)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SearchEnabled").build()).build(); private static final SdkField RETURN_ENABLED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(DateArrayOptions::returnEnabled)).setter(setter(Builder::returnEnabled)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ReturnEnabled").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DEFAULT_VALUE_FIELD, SOURCE_FIELDS_FIELD, FACET_ENABLED_FIELD, SEARCH_ENABLED_FIELD, RETURN_ENABLED_FIELD)); private static final long serialVersionUID = 1L; private final String defaultValue; private final String sourceFields; private final Boolean facetEnabled; private final Boolean searchEnabled; private final Boolean returnEnabled; private DateArrayOptions(BuilderImpl builder) { this.defaultValue = builder.defaultValue; this.sourceFields = builder.sourceFields; this.facetEnabled = builder.facetEnabled; this.searchEnabled = builder.searchEnabled; this.returnEnabled = builder.returnEnabled; } /** * 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 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 String sourceFields() { return sourceFields; } /** *

* Whether facet information can be returned for the field. *

* * @return Whether facet information can be returned for the field. */ public Boolean facetEnabled() { return facetEnabled; } /** *

* Whether the contents of the field are searchable. *

* * @return Whether the contents of the field are searchable. */ public Boolean searchEnabled() { return searchEnabled; } /** *

* 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 Boolean returnEnabled() { return returnEnabled; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(defaultValue()); hashCode = 31 * hashCode + Objects.hashCode(sourceFields()); hashCode = 31 * hashCode + Objects.hashCode(facetEnabled()); hashCode = 31 * hashCode + Objects.hashCode(searchEnabled()); hashCode = 31 * hashCode + Objects.hashCode(returnEnabled()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DateArrayOptions)) { return false; } DateArrayOptions other = (DateArrayOptions) obj; return Objects.equals(defaultValue(), other.defaultValue()) && Objects.equals(sourceFields(), other.sourceFields()) && Objects.equals(facetEnabled(), other.facetEnabled()) && Objects.equals(searchEnabled(), other.searchEnabled()) && Objects.equals(returnEnabled(), other.returnEnabled()); } /** * 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 String toString() { return ToString.builder("DateArrayOptions").add("DefaultValue", defaultValue()).add("SourceFields", sourceFields()) .add("FacetEnabled", facetEnabled()).add("SearchEnabled", searchEnabled()).add("ReturnEnabled", returnEnabled()) .build(); } public 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 "FacetEnabled": return Optional.ofNullable(clazz.cast(facetEnabled())); case "SearchEnabled": return Optional.ofNullable(clazz.cast(searchEnabled())); case "ReturnEnabled": return Optional.ofNullable(clazz.cast(returnEnabled())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DateArrayOptions) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** * A value to use for the field if the field isn't specified for a document. * * @param defaultValue * A value to use for the field if the field isn't specified for a document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder defaultValue(String defaultValue); /** *

* A list of source fields to map to the field. *

* * @param sourceFields * A list of source fields to map to the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceFields(String sourceFields); /** *

* Whether facet information can be returned for the field. *

* * @param facetEnabled * Whether facet information can be returned for the field. * @return Returns a reference to this object so that method calls can be chained together. */ Builder facetEnabled(Boolean facetEnabled); /** *

* Whether the contents of the field are searchable. *

* * @param searchEnabled * Whether the contents of the field are searchable. * @return Returns a reference to this object so that method calls can be chained together. */ Builder searchEnabled(Boolean searchEnabled); /** *

* Whether the contents of the field can be returned in the search results. *

* * @param returnEnabled * Whether the contents of the field can be returned in the search results. * @return Returns a reference to this object so that method calls can be chained together. */ Builder returnEnabled(Boolean returnEnabled); } static final class BuilderImpl implements Builder { private String defaultValue; private String sourceFields; private Boolean facetEnabled; private Boolean searchEnabled; private Boolean returnEnabled; private BuilderImpl() { } private BuilderImpl(DateArrayOptions model) { defaultValue(model.defaultValue); sourceFields(model.sourceFields); facetEnabled(model.facetEnabled); searchEnabled(model.searchEnabled); returnEnabled(model.returnEnabled); } public final String getDefaultValue() { return defaultValue; } @Override public final Builder defaultValue(String defaultValue) { this.defaultValue = defaultValue; return this; } public final void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } public final String getSourceFields() { return sourceFields; } @Override public final Builder sourceFields(String sourceFields) { this.sourceFields = sourceFields; return this; } public final void setSourceFields(String sourceFields) { this.sourceFields = sourceFields; } public final Boolean getFacetEnabled() { return facetEnabled; } @Override public final Builder facetEnabled(Boolean facetEnabled) { this.facetEnabled = facetEnabled; return this; } public final void setFacetEnabled(Boolean facetEnabled) { this.facetEnabled = facetEnabled; } public final Boolean getSearchEnabled() { return searchEnabled; } @Override public final Builder searchEnabled(Boolean searchEnabled) { this.searchEnabled = searchEnabled; return this; } public final void setSearchEnabled(Boolean searchEnabled) { this.searchEnabled = searchEnabled; } public final Boolean getReturnEnabled() { return returnEnabled; } @Override public final Builder returnEnabled(Boolean returnEnabled) { this.returnEnabled = returnEnabled; return this; } public final void setReturnEnabled(Boolean returnEnabled) { this.returnEnabled = returnEnabled; } @Override public DateArrayOptions build() { return new DateArrayOptions(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy