
software.amazon.awssdk.services.honeycode.model.DelimitedTextImportOptions 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.honeycode.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;
/**
*
* An object that contains the options relating to parsing delimited text as part of an import request.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DelimitedTextImportOptions implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField DELIMITER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("delimiter").getter(getter(DelimitedTextImportOptions::delimiter)).setter(setter(Builder::delimiter))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("delimiter").build()).build();
private static final SdkField HAS_HEADER_ROW_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("hasHeaderRow").getter(getter(DelimitedTextImportOptions::hasHeaderRow))
.setter(setter(Builder::hasHeaderRow))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("hasHeaderRow").build()).build();
private static final SdkField IGNORE_EMPTY_ROWS_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("ignoreEmptyRows").getter(getter(DelimitedTextImportOptions::ignoreEmptyRows))
.setter(setter(Builder::ignoreEmptyRows))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ignoreEmptyRows").build()).build();
private static final SdkField DATA_CHARACTER_ENCODING_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("dataCharacterEncoding").getter(getter(DelimitedTextImportOptions::dataCharacterEncodingAsString))
.setter(setter(Builder::dataCharacterEncoding))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dataCharacterEncoding").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DELIMITER_FIELD,
HAS_HEADER_ROW_FIELD, IGNORE_EMPTY_ROWS_FIELD, DATA_CHARACTER_ENCODING_FIELD));
private static final long serialVersionUID = 1L;
private final String delimiter;
private final Boolean hasHeaderRow;
private final Boolean ignoreEmptyRows;
private final String dataCharacterEncoding;
private DelimitedTextImportOptions(BuilderImpl builder) {
this.delimiter = builder.delimiter;
this.hasHeaderRow = builder.hasHeaderRow;
this.ignoreEmptyRows = builder.ignoreEmptyRows;
this.dataCharacterEncoding = builder.dataCharacterEncoding;
}
/**
*
* The delimiter to use for separating columns in a single row of the input.
*
*
* @return The delimiter to use for separating columns in a single row of the input.
*/
public final String delimiter() {
return delimiter;
}
/**
*
* Indicates whether the input file has a header row at the top containing the column names.
*
*
* @return Indicates whether the input file has a header row at the top containing the column names.
*/
public final Boolean hasHeaderRow() {
return hasHeaderRow;
}
/**
*
* A parameter to indicate whether empty rows should be ignored or be included in the import.
*
*
* @return A parameter to indicate whether empty rows should be ignored or be included in the import.
*/
public final Boolean ignoreEmptyRows() {
return ignoreEmptyRows;
}
/**
*
* The encoding of the data in the input file.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataCharacterEncoding} will return {@link ImportDataCharacterEncoding#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #dataCharacterEncodingAsString}.
*
*
* @return The encoding of the data in the input file.
* @see ImportDataCharacterEncoding
*/
public final ImportDataCharacterEncoding dataCharacterEncoding() {
return ImportDataCharacterEncoding.fromValue(dataCharacterEncoding);
}
/**
*
* The encoding of the data in the input file.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataCharacterEncoding} will return {@link ImportDataCharacterEncoding#UNKNOWN_TO_SDK_VERSION}. The raw
* value returned by the service is available from {@link #dataCharacterEncodingAsString}.
*
*
* @return The encoding of the data in the input file.
* @see ImportDataCharacterEncoding
*/
public final String dataCharacterEncodingAsString() {
return dataCharacterEncoding;
}
@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(delimiter());
hashCode = 31 * hashCode + Objects.hashCode(hasHeaderRow());
hashCode = 31 * hashCode + Objects.hashCode(ignoreEmptyRows());
hashCode = 31 * hashCode + Objects.hashCode(dataCharacterEncodingAsString());
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 DelimitedTextImportOptions)) {
return false;
}
DelimitedTextImportOptions other = (DelimitedTextImportOptions) obj;
return Objects.equals(delimiter(), other.delimiter()) && Objects.equals(hasHeaderRow(), other.hasHeaderRow())
&& Objects.equals(ignoreEmptyRows(), other.ignoreEmptyRows())
&& Objects.equals(dataCharacterEncodingAsString(), other.dataCharacterEncodingAsString());
}
/**
* 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("DelimitedTextImportOptions").add("Delimiter", delimiter()).add("HasHeaderRow", hasHeaderRow())
.add("IgnoreEmptyRows", ignoreEmptyRows()).add("DataCharacterEncoding", dataCharacterEncodingAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "delimiter":
return Optional.ofNullable(clazz.cast(delimiter()));
case "hasHeaderRow":
return Optional.ofNullable(clazz.cast(hasHeaderRow()));
case "ignoreEmptyRows":
return Optional.ofNullable(clazz.cast(ignoreEmptyRows()));
case "dataCharacterEncoding":
return Optional.ofNullable(clazz.cast(dataCharacterEncodingAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function