
software.amazon.awssdk.services.glue.model.CreateCsvClassifierRequest 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.glue.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;
/**
*
* Specifies a custom CSV classifier for CreateClassifier
to create.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CreateCsvClassifierRequest implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(CreateCsvClassifierRequest::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField DELIMITER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Delimiter").getter(getter(CreateCsvClassifierRequest::delimiter)).setter(setter(Builder::delimiter))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Delimiter").build()).build();
private static final SdkField QUOTE_SYMBOL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuoteSymbol").getter(getter(CreateCsvClassifierRequest::quoteSymbol))
.setter(setter(Builder::quoteSymbol))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuoteSymbol").build()).build();
private static final SdkField CONTAINS_HEADER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ContainsHeader").getter(getter(CreateCsvClassifierRequest::containsHeaderAsString))
.setter(setter(Builder::containsHeader))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContainsHeader").build()).build();
private static final SdkField> HEADER_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Header")
.getter(getter(CreateCsvClassifierRequest::header))
.setter(setter(Builder::header))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Header").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 DISABLE_VALUE_TRIMMING_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DisableValueTrimming").getter(getter(CreateCsvClassifierRequest::disableValueTrimming))
.setter(setter(Builder::disableValueTrimming))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DisableValueTrimming").build())
.build();
private static final SdkField ALLOW_SINGLE_COLUMN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("AllowSingleColumn").getter(getter(CreateCsvClassifierRequest::allowSingleColumn))
.setter(setter(Builder::allowSingleColumn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowSingleColumn").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, DELIMITER_FIELD,
QUOTE_SYMBOL_FIELD, CONTAINS_HEADER_FIELD, HEADER_FIELD, DISABLE_VALUE_TRIMMING_FIELD, ALLOW_SINGLE_COLUMN_FIELD));
private static final long serialVersionUID = 1L;
private final String name;
private final String delimiter;
private final String quoteSymbol;
private final String containsHeader;
private final List header;
private final Boolean disableValueTrimming;
private final Boolean allowSingleColumn;
private CreateCsvClassifierRequest(BuilderImpl builder) {
this.name = builder.name;
this.delimiter = builder.delimiter;
this.quoteSymbol = builder.quoteSymbol;
this.containsHeader = builder.containsHeader;
this.header = builder.header;
this.disableValueTrimming = builder.disableValueTrimming;
this.allowSingleColumn = builder.allowSingleColumn;
}
/**
*
* The name of the classifier.
*
*
* @return The name of the classifier.
*/
public final String name() {
return name;
}
/**
*
* A custom symbol to denote what separates each column entry in the row.
*
*
* @return A custom symbol to denote what separates each column entry in the row.
*/
public final String delimiter() {
return delimiter;
}
/**
*
* A custom symbol to denote what combines content into a single column value. Must be different from the column
* delimiter.
*
*
* @return A custom symbol to denote what combines content into a single column value. Must be different from the
* column delimiter.
*/
public final String quoteSymbol() {
return quoteSymbol;
}
/**
*
* Indicates whether the CSV file contains a header.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #containsHeader}
* will return {@link CsvHeaderOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #containsHeaderAsString}.
*
*
* @return Indicates whether the CSV file contains a header.
* @see CsvHeaderOption
*/
public final CsvHeaderOption containsHeader() {
return CsvHeaderOption.fromValue(containsHeader);
}
/**
*
* Indicates whether the CSV file contains a header.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #containsHeader}
* will return {@link CsvHeaderOption#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #containsHeaderAsString}.
*
*
* @return Indicates whether the CSV file contains a header.
* @see CsvHeaderOption
*/
public final String containsHeaderAsString() {
return containsHeader;
}
/**
* Returns true if the Header property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasHeader() {
return header != null && !(header instanceof SdkAutoConstructList);
}
/**
*
* A list of strings representing column names.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasHeader()} to see if a value was sent in this field.
*
*
* @return A list of strings representing column names.
*/
public final List header() {
return header;
}
/**
*
* Specifies not to trim values before identifying the type of column values. The default value is true.
*
*
* @return Specifies not to trim values before identifying the type of column values. The default value is true.
*/
public final Boolean disableValueTrimming() {
return disableValueTrimming;
}
/**
*
* Enables the processing of files that contain only one column.
*
*
* @return Enables the processing of files that contain only one column.
*/
public final Boolean allowSingleColumn() {
return allowSingleColumn;
}
@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(name());
hashCode = 31 * hashCode + Objects.hashCode(delimiter());
hashCode = 31 * hashCode + Objects.hashCode(quoteSymbol());
hashCode = 31 * hashCode + Objects.hashCode(containsHeaderAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasHeader() ? header() : null);
hashCode = 31 * hashCode + Objects.hashCode(disableValueTrimming());
hashCode = 31 * hashCode + Objects.hashCode(allowSingleColumn());
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 CreateCsvClassifierRequest)) {
return false;
}
CreateCsvClassifierRequest other = (CreateCsvClassifierRequest) obj;
return Objects.equals(name(), other.name()) && Objects.equals(delimiter(), other.delimiter())
&& Objects.equals(quoteSymbol(), other.quoteSymbol())
&& Objects.equals(containsHeaderAsString(), other.containsHeaderAsString()) && hasHeader() == other.hasHeader()
&& Objects.equals(header(), other.header())
&& Objects.equals(disableValueTrimming(), other.disableValueTrimming())
&& Objects.equals(allowSingleColumn(), other.allowSingleColumn());
}
/**
* 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("CreateCsvClassifierRequest").add("Name", name()).add("Delimiter", delimiter())
.add("QuoteSymbol", quoteSymbol()).add("ContainsHeader", containsHeaderAsString())
.add("Header", hasHeader() ? header() : null).add("DisableValueTrimming", disableValueTrimming())
.add("AllowSingleColumn", allowSingleColumn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Delimiter":
return Optional.ofNullable(clazz.cast(delimiter()));
case "QuoteSymbol":
return Optional.ofNullable(clazz.cast(quoteSymbol()));
case "ContainsHeader":
return Optional.ofNullable(clazz.cast(containsHeaderAsString()));
case "Header":
return Optional.ofNullable(clazz.cast(header()));
case "DisableValueTrimming":
return Optional.ofNullable(clazz.cast(disableValueTrimming()));
case "AllowSingleColumn":
return Optional.ofNullable(clazz.cast(allowSingleColumn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function