software.amazon.awssdk.services.timestreamwrite.model.CsvConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timestreamwrite Show documentation
Show all versions of timestreamwrite Show documentation
The AWS Java SDK for Timestream Write module holds the client classes that are used for
communicating with Timestream Write.
/*
* 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.timestreamwrite.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;
/**
*
* A delimited data format where the column separator can be a comma and the record separator is a newline character.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class CsvConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField COLUMN_SEPARATOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ColumnSeparator").getter(getter(CsvConfiguration::columnSeparator))
.setter(setter(Builder::columnSeparator))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ColumnSeparator").build()).build();
private static final SdkField ESCAPE_CHAR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EscapeChar").getter(getter(CsvConfiguration::escapeChar)).setter(setter(Builder::escapeChar))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EscapeChar").build()).build();
private static final SdkField QUOTE_CHAR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("QuoteChar").getter(getter(CsvConfiguration::quoteChar)).setter(setter(Builder::quoteChar))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuoteChar").build()).build();
private static final SdkField NULL_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("NullValue").getter(getter(CsvConfiguration::nullValue)).setter(setter(Builder::nullValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NullValue").build()).build();
private static final SdkField TRIM_WHITE_SPACE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("TrimWhiteSpace").getter(getter(CsvConfiguration::trimWhiteSpace))
.setter(setter(Builder::trimWhiteSpace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TrimWhiteSpace").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COLUMN_SEPARATOR_FIELD,
ESCAPE_CHAR_FIELD, QUOTE_CHAR_FIELD, NULL_VALUE_FIELD, TRIM_WHITE_SPACE_FIELD));
private static final long serialVersionUID = 1L;
private final String columnSeparator;
private final String escapeChar;
private final String quoteChar;
private final String nullValue;
private final Boolean trimWhiteSpace;
private CsvConfiguration(BuilderImpl builder) {
this.columnSeparator = builder.columnSeparator;
this.escapeChar = builder.escapeChar;
this.quoteChar = builder.quoteChar;
this.nullValue = builder.nullValue;
this.trimWhiteSpace = builder.trimWhiteSpace;
}
/**
*
* Column separator can be one of comma (','), pipe ('|), semicolon (';'), tab('/t'), or blank space (' ').
*
*
* @return Column separator can be one of comma (','), pipe ('|), semicolon (';'), tab('/t'), or blank space (' ').
*/
public final String columnSeparator() {
return columnSeparator;
}
/**
*
* Escape character can be one of
*
*
* @return Escape character can be one of
*/
public final String escapeChar() {
return escapeChar;
}
/**
*
* Can be single quote (') or double quote (").
*
*
* @return Can be single quote (') or double quote (").
*/
public final String quoteChar() {
return quoteChar;
}
/**
*
* Can be blank space (' ').
*
*
* @return Can be blank space (' ').
*/
public final String nullValue() {
return nullValue;
}
/**
*
* Specifies to trim leading and trailing white space.
*
*
* @return Specifies to trim leading and trailing white space.
*/
public final Boolean trimWhiteSpace() {
return trimWhiteSpace;
}
@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(columnSeparator());
hashCode = 31 * hashCode + Objects.hashCode(escapeChar());
hashCode = 31 * hashCode + Objects.hashCode(quoteChar());
hashCode = 31 * hashCode + Objects.hashCode(nullValue());
hashCode = 31 * hashCode + Objects.hashCode(trimWhiteSpace());
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 CsvConfiguration)) {
return false;
}
CsvConfiguration other = (CsvConfiguration) obj;
return Objects.equals(columnSeparator(), other.columnSeparator()) && Objects.equals(escapeChar(), other.escapeChar())
&& Objects.equals(quoteChar(), other.quoteChar()) && Objects.equals(nullValue(), other.nullValue())
&& Objects.equals(trimWhiteSpace(), other.trimWhiteSpace());
}
/**
* 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("CsvConfiguration").add("ColumnSeparator", columnSeparator()).add("EscapeChar", escapeChar())
.add("QuoteChar", quoteChar()).add("NullValue", nullValue()).add("TrimWhiteSpace", trimWhiteSpace()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ColumnSeparator":
return Optional.ofNullable(clazz.cast(columnSeparator()));
case "EscapeChar":
return Optional.ofNullable(clazz.cast(escapeChar()));
case "QuoteChar":
return Optional.ofNullable(clazz.cast(quoteChar()));
case "NullValue":
return Optional.ofNullable(clazz.cast(nullValue()));
case "TrimWhiteSpace":
return Optional.ofNullable(clazz.cast(trimWhiteSpace()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function