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

software.amazon.awssdk.services.timestreamwrite.model.CsvConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Timestream Write module holds the client classes that are used for communicating with Timestream Write.

There is a newer version: 2.28.4
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((CsvConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Column separator can be one of comma (','), pipe ('|), semicolon (';'), tab('/t'), or blank space (' '). *

* * @param columnSeparator * Column separator can be one of comma (','), pipe ('|), semicolon (';'), tab('/t'), or blank space * (' '). * @return Returns a reference to this object so that method calls can be chained together. */ Builder columnSeparator(String columnSeparator); /** *

* Escape character can be one of *

* * @param escapeChar * Escape character can be one of * @return Returns a reference to this object so that method calls can be chained together. */ Builder escapeChar(String escapeChar); /** *

* Can be single quote (') or double quote ("). *

* * @param quoteChar * Can be single quote (') or double quote ("). * @return Returns a reference to this object so that method calls can be chained together. */ Builder quoteChar(String quoteChar); /** *

* Can be blank space (' '). *

* * @param nullValue * Can be blank space (' '). * @return Returns a reference to this object so that method calls can be chained together. */ Builder nullValue(String nullValue); /** *

* Specifies to trim leading and trailing white space. *

* * @param trimWhiteSpace * Specifies to trim leading and trailing white space. * @return Returns a reference to this object so that method calls can be chained together. */ Builder trimWhiteSpace(Boolean trimWhiteSpace); } static final class BuilderImpl implements Builder { private String columnSeparator; private String escapeChar; private String quoteChar; private String nullValue; private Boolean trimWhiteSpace; private BuilderImpl() { } private BuilderImpl(CsvConfiguration model) { columnSeparator(model.columnSeparator); escapeChar(model.escapeChar); quoteChar(model.quoteChar); nullValue(model.nullValue); trimWhiteSpace(model.trimWhiteSpace); } public final String getColumnSeparator() { return columnSeparator; } public final void setColumnSeparator(String columnSeparator) { this.columnSeparator = columnSeparator; } @Override public final Builder columnSeparator(String columnSeparator) { this.columnSeparator = columnSeparator; return this; } public final String getEscapeChar() { return escapeChar; } public final void setEscapeChar(String escapeChar) { this.escapeChar = escapeChar; } @Override public final Builder escapeChar(String escapeChar) { this.escapeChar = escapeChar; return this; } public final String getQuoteChar() { return quoteChar; } public final void setQuoteChar(String quoteChar) { this.quoteChar = quoteChar; } @Override public final Builder quoteChar(String quoteChar) { this.quoteChar = quoteChar; return this; } public final String getNullValue() { return nullValue; } public final void setNullValue(String nullValue) { this.nullValue = nullValue; } @Override public final Builder nullValue(String nullValue) { this.nullValue = nullValue; return this; } public final Boolean getTrimWhiteSpace() { return trimWhiteSpace; } public final void setTrimWhiteSpace(Boolean trimWhiteSpace) { this.trimWhiteSpace = trimWhiteSpace; } @Override public final Builder trimWhiteSpace(Boolean trimWhiteSpace) { this.trimWhiteSpace = trimWhiteSpace; return this; } @Override public CsvConfiguration build() { return new CsvConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy