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

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 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 getter(Function g) { return obj -> g.apply((CreateCsvClassifierRequest) 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 classifier. *

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

* A custom symbol to denote what separates each column entry in the row. *

* * @param delimiter * A custom symbol to denote what separates each column entry in the row. * @return Returns a reference to this object so that method calls can be chained together. */ Builder delimiter(String delimiter); /** *

* A custom symbol to denote what combines content into a single column value. Must be different from the column * delimiter. *

* * @param quoteSymbol * A custom symbol to denote what combines content into a single column value. Must be different from the * column delimiter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder quoteSymbol(String quoteSymbol); /** *

* Indicates whether the CSV file contains a header. *

* * @param containsHeader * Indicates whether the CSV file contains a header. * @see CsvHeaderOption * @return Returns a reference to this object so that method calls can be chained together. * @see CsvHeaderOption */ Builder containsHeader(String containsHeader); /** *

* Indicates whether the CSV file contains a header. *

* * @param containsHeader * Indicates whether the CSV file contains a header. * @see CsvHeaderOption * @return Returns a reference to this object so that method calls can be chained together. * @see CsvHeaderOption */ Builder containsHeader(CsvHeaderOption containsHeader); /** *

* A list of strings representing column names. *

* * @param header * A list of strings representing column names. * @return Returns a reference to this object so that method calls can be chained together. */ Builder header(Collection header); /** *

* A list of strings representing column names. *

* * @param header * A list of strings representing column names. * @return Returns a reference to this object so that method calls can be chained together. */ Builder header(String... header); /** *

* Specifies not to trim values before identifying the type of column values. The default value is true. *

* * @param disableValueTrimming * Specifies not to trim values before identifying the type of column values. The default value is true. * @return Returns a reference to this object so that method calls can be chained together. */ Builder disableValueTrimming(Boolean disableValueTrimming); /** *

* Enables the processing of files that contain only one column. *

* * @param allowSingleColumn * Enables the processing of files that contain only one column. * @return Returns a reference to this object so that method calls can be chained together. */ Builder allowSingleColumn(Boolean allowSingleColumn); } static final class BuilderImpl implements Builder { private String name; private String delimiter; private String quoteSymbol; private String containsHeader; private List header = DefaultSdkAutoConstructList.getInstance(); private Boolean disableValueTrimming; private Boolean allowSingleColumn; private BuilderImpl() { } private BuilderImpl(CreateCsvClassifierRequest model) { name(model.name); delimiter(model.delimiter); quoteSymbol(model.quoteSymbol); containsHeader(model.containsHeader); header(model.header); disableValueTrimming(model.disableValueTrimming); allowSingleColumn(model.allowSingleColumn); } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getDelimiter() { return delimiter; } @Override public final Builder delimiter(String delimiter) { this.delimiter = delimiter; return this; } public final void setDelimiter(String delimiter) { this.delimiter = delimiter; } public final String getQuoteSymbol() { return quoteSymbol; } @Override public final Builder quoteSymbol(String quoteSymbol) { this.quoteSymbol = quoteSymbol; return this; } public final void setQuoteSymbol(String quoteSymbol) { this.quoteSymbol = quoteSymbol; } public final String getContainsHeader() { return containsHeader; } @Override public final Builder containsHeader(String containsHeader) { this.containsHeader = containsHeader; return this; } @Override public final Builder containsHeader(CsvHeaderOption containsHeader) { this.containsHeader(containsHeader == null ? null : containsHeader.toString()); return this; } public final void setContainsHeader(String containsHeader) { this.containsHeader = containsHeader; } public final Collection getHeader() { if (header instanceof SdkAutoConstructList) { return null; } return header; } @Override public final Builder header(Collection header) { this.header = CsvHeaderCopier.copy(header); return this; } @Override @SafeVarargs public final Builder header(String... header) { header(Arrays.asList(header)); return this; } public final void setHeader(Collection header) { this.header = CsvHeaderCopier.copy(header); } public final Boolean getDisableValueTrimming() { return disableValueTrimming; } @Override public final Builder disableValueTrimming(Boolean disableValueTrimming) { this.disableValueTrimming = disableValueTrimming; return this; } public final void setDisableValueTrimming(Boolean disableValueTrimming) { this.disableValueTrimming = disableValueTrimming; } public final Boolean getAllowSingleColumn() { return allowSingleColumn; } @Override public final Builder allowSingleColumn(Boolean allowSingleColumn) { this.allowSingleColumn = allowSingleColumn; return this; } public final void setAllowSingleColumn(Boolean allowSingleColumn) { this.allowSingleColumn = allowSingleColumn; } @Override public CreateCsvClassifierRequest build() { return new CreateCsvClassifierRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy