software.amazon.awssdk.services.s3.model.SelectParameters Maven / Gradle / Ivy
Show all versions of s3 Show documentation
/*
* 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.s3.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.core.traits.RequiredTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes the parameters for Select job types.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SelectParameters implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INPUT_SERIALIZATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("InputSerialization")
.getter(getter(SelectParameters::inputSerialization))
.setter(setter(Builder::inputSerialization))
.constructor(InputSerialization::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputSerialization")
.unmarshallLocationName("InputSerialization").build(), RequiredTrait.create()).build();
private static final SdkField EXPRESSION_TYPE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ExpressionType")
.getter(getter(SelectParameters::expressionTypeAsString))
.setter(setter(Builder::expressionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExpressionType")
.unmarshallLocationName("ExpressionType").build(), RequiredTrait.create()).build();
private static final SdkField EXPRESSION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Expression")
.getter(getter(SelectParameters::expression))
.setter(setter(Builder::expression))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Expression")
.unmarshallLocationName("Expression").build(), RequiredTrait.create()).build();
private static final SdkField OUTPUT_SERIALIZATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("OutputSerialization")
.getter(getter(SelectParameters::outputSerialization))
.setter(setter(Builder::outputSerialization))
.constructor(OutputSerialization::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputSerialization")
.unmarshallLocationName("OutputSerialization").build(), RequiredTrait.create()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INPUT_SERIALIZATION_FIELD,
EXPRESSION_TYPE_FIELD, EXPRESSION_FIELD, OUTPUT_SERIALIZATION_FIELD));
private static final long serialVersionUID = 1L;
private final InputSerialization inputSerialization;
private final String expressionType;
private final String expression;
private final OutputSerialization outputSerialization;
private SelectParameters(BuilderImpl builder) {
this.inputSerialization = builder.inputSerialization;
this.expressionType = builder.expressionType;
this.expression = builder.expression;
this.outputSerialization = builder.outputSerialization;
}
/**
*
* Describes the serialization format of the object.
*
*
* @return Describes the serialization format of the object.
*/
public final InputSerialization inputSerialization() {
return inputSerialization;
}
/**
*
* The type of the provided expression (for example, SQL).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #expressionType}
* will return {@link ExpressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #expressionTypeAsString}.
*
*
* @return The type of the provided expression (for example, SQL).
* @see ExpressionType
*/
public final ExpressionType expressionType() {
return ExpressionType.fromValue(expressionType);
}
/**
*
* The type of the provided expression (for example, SQL).
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #expressionType}
* will return {@link ExpressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #expressionTypeAsString}.
*
*
* @return The type of the provided expression (for example, SQL).
* @see ExpressionType
*/
public final String expressionTypeAsString() {
return expressionType;
}
/**
*
* The expression that is used to query the object.
*
*
* @return The expression that is used to query the object.
*/
public final String expression() {
return expression;
}
/**
*
* Describes how the results of the Select job are serialized.
*
*
* @return Describes how the results of the Select job are serialized.
*/
public final OutputSerialization outputSerialization() {
return outputSerialization;
}
@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(inputSerialization());
hashCode = 31 * hashCode + Objects.hashCode(expressionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(expression());
hashCode = 31 * hashCode + Objects.hashCode(outputSerialization());
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 SelectParameters)) {
return false;
}
SelectParameters other = (SelectParameters) obj;
return Objects.equals(inputSerialization(), other.inputSerialization())
&& Objects.equals(expressionTypeAsString(), other.expressionTypeAsString())
&& Objects.equals(expression(), other.expression())
&& Objects.equals(outputSerialization(), other.outputSerialization());
}
/**
* 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("SelectParameters").add("InputSerialization", inputSerialization())
.add("ExpressionType", expressionTypeAsString()).add("Expression", expression())
.add("OutputSerialization", outputSerialization()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InputSerialization":
return Optional.ofNullable(clazz.cast(inputSerialization()));
case "ExpressionType":
return Optional.ofNullable(clazz.cast(expressionTypeAsString()));
case "Expression":
return Optional.ofNullable(clazz.cast(expression()));
case "OutputSerialization":
return Optional.ofNullable(clazz.cast(outputSerialization()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function