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

software.amazon.awssdk.services.glacier.model.CSVInput Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Glacier module holds the client classes that are used for communicating with Amazon Glacier Service

There is a newer version: 2.30.1
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.glacier.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;

/**
 * 

* Contains information about the comma-separated value (CSV) file to select from. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CSVInput implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FILE_HEADER_INFO_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FileHeaderInfo").getter(getter(CSVInput::fileHeaderInfoAsString)) .setter(setter(Builder::fileHeaderInfo)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FileHeaderInfo").build()).build(); private static final SdkField COMMENTS_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Comments").getter(getter(CSVInput::comments)).setter(setter(Builder::comments)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Comments").build()).build(); private static final SdkField QUOTE_ESCAPE_CHARACTER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("QuoteEscapeCharacter").getter(getter(CSVInput::quoteEscapeCharacter)) .setter(setter(Builder::quoteEscapeCharacter)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuoteEscapeCharacter").build()) .build(); private static final SdkField RECORD_DELIMITER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("RecordDelimiter").getter(getter(CSVInput::recordDelimiter)).setter(setter(Builder::recordDelimiter)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecordDelimiter").build()).build(); private static final SdkField FIELD_DELIMITER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("FieldDelimiter").getter(getter(CSVInput::fieldDelimiter)).setter(setter(Builder::fieldDelimiter)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FieldDelimiter").build()).build(); private static final SdkField QUOTE_CHARACTER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("QuoteCharacter").getter(getter(CSVInput::quoteCharacter)).setter(setter(Builder::quoteCharacter)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuoteCharacter").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FILE_HEADER_INFO_FIELD, COMMENTS_FIELD, QUOTE_ESCAPE_CHARACTER_FIELD, RECORD_DELIMITER_FIELD, FIELD_DELIMITER_FIELD, QUOTE_CHARACTER_FIELD)); private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer(); private static final long serialVersionUID = 1L; private final String fileHeaderInfo; private final String comments; private final String quoteEscapeCharacter; private final String recordDelimiter; private final String fieldDelimiter; private final String quoteCharacter; private CSVInput(BuilderImpl builder) { this.fileHeaderInfo = builder.fileHeaderInfo; this.comments = builder.comments; this.quoteEscapeCharacter = builder.quoteEscapeCharacter; this.recordDelimiter = builder.recordDelimiter; this.fieldDelimiter = builder.fieldDelimiter; this.quoteCharacter = builder.quoteCharacter; } /** *

* Describes the first line of input. Valid values are None, Ignore, and Use. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #fileHeaderInfo} * will return {@link FileHeaderInfo#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #fileHeaderInfoAsString}. *

* * @return Describes the first line of input. Valid values are None, Ignore, and * Use. * @see FileHeaderInfo */ public final FileHeaderInfo fileHeaderInfo() { return FileHeaderInfo.fromValue(fileHeaderInfo); } /** *

* Describes the first line of input. Valid values are None, Ignore, and Use. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #fileHeaderInfo} * will return {@link FileHeaderInfo#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #fileHeaderInfoAsString}. *

* * @return Describes the first line of input. Valid values are None, Ignore, and * Use. * @see FileHeaderInfo */ public final String fileHeaderInfoAsString() { return fileHeaderInfo; } /** *

* A single character used to indicate that a row should be ignored when the character is present at the start of * that row. *

* * @return A single character used to indicate that a row should be ignored when the character is present at the * start of that row. */ public final String comments() { return comments; } /** *

* A single character used for escaping the quotation-mark character inside an already escaped value. *

* * @return A single character used for escaping the quotation-mark character inside an already escaped value. */ public final String quoteEscapeCharacter() { return quoteEscapeCharacter; } /** *

* A value used to separate individual records from each other. *

* * @return A value used to separate individual records from each other. */ public final String recordDelimiter() { return recordDelimiter; } /** *

* A value used to separate individual fields from each other within a record. *

* * @return A value used to separate individual fields from each other within a record. */ public final String fieldDelimiter() { return fieldDelimiter; } /** *

* A value used as an escape character where the field delimiter is part of the value. *

* * @return A value used as an escape character where the field delimiter is part of the value. */ public final String quoteCharacter() { return quoteCharacter; } @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(fileHeaderInfoAsString()); hashCode = 31 * hashCode + Objects.hashCode(comments()); hashCode = 31 * hashCode + Objects.hashCode(quoteEscapeCharacter()); hashCode = 31 * hashCode + Objects.hashCode(recordDelimiter()); hashCode = 31 * hashCode + Objects.hashCode(fieldDelimiter()); hashCode = 31 * hashCode + Objects.hashCode(quoteCharacter()); 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 CSVInput)) { return false; } CSVInput other = (CSVInput) obj; return Objects.equals(fileHeaderInfoAsString(), other.fileHeaderInfoAsString()) && Objects.equals(comments(), other.comments()) && Objects.equals(quoteEscapeCharacter(), other.quoteEscapeCharacter()) && Objects.equals(recordDelimiter(), other.recordDelimiter()) && Objects.equals(fieldDelimiter(), other.fieldDelimiter()) && Objects.equals(quoteCharacter(), other.quoteCharacter()); } /** * 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("CSVInput").add("FileHeaderInfo", fileHeaderInfoAsString()).add("Comments", comments()) .add("QuoteEscapeCharacter", quoteEscapeCharacter()).add("RecordDelimiter", recordDelimiter()) .add("FieldDelimiter", fieldDelimiter()).add("QuoteCharacter", quoteCharacter()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "FileHeaderInfo": return Optional.ofNullable(clazz.cast(fileHeaderInfoAsString())); case "Comments": return Optional.ofNullable(clazz.cast(comments())); case "QuoteEscapeCharacter": return Optional.ofNullable(clazz.cast(quoteEscapeCharacter())); case "RecordDelimiter": return Optional.ofNullable(clazz.cast(recordDelimiter())); case "FieldDelimiter": return Optional.ofNullable(clazz.cast(fieldDelimiter())); case "QuoteCharacter": return Optional.ofNullable(clazz.cast(quoteCharacter())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } @Override public final Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } private static Map> memberNameToFieldInitializer() { Map> map = new HashMap<>(); map.put("FileHeaderInfo", FILE_HEADER_INFO_FIELD); map.put("Comments", COMMENTS_FIELD); map.put("QuoteEscapeCharacter", QUOTE_ESCAPE_CHARACTER_FIELD); map.put("RecordDelimiter", RECORD_DELIMITER_FIELD); map.put("FieldDelimiter", FIELD_DELIMITER_FIELD); map.put("QuoteCharacter", QUOTE_CHARACTER_FIELD); return Collections.unmodifiableMap(map); } private static Function getter(Function g) { return obj -> g.apply((CSVInput) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Describes the first line of input. Valid values are None, Ignore, and * Use. *

* * @param fileHeaderInfo * Describes the first line of input. Valid values are None, Ignore, and * Use. * @see FileHeaderInfo * @return Returns a reference to this object so that method calls can be chained together. * @see FileHeaderInfo */ Builder fileHeaderInfo(String fileHeaderInfo); /** *

* Describes the first line of input. Valid values are None, Ignore, and * Use. *

* * @param fileHeaderInfo * Describes the first line of input. Valid values are None, Ignore, and * Use. * @see FileHeaderInfo * @return Returns a reference to this object so that method calls can be chained together. * @see FileHeaderInfo */ Builder fileHeaderInfo(FileHeaderInfo fileHeaderInfo); /** *

* A single character used to indicate that a row should be ignored when the character is present at the start * of that row. *

* * @param comments * A single character used to indicate that a row should be ignored when the character is present at the * start of that row. * @return Returns a reference to this object so that method calls can be chained together. */ Builder comments(String comments); /** *

* A single character used for escaping the quotation-mark character inside an already escaped value. *

* * @param quoteEscapeCharacter * A single character used for escaping the quotation-mark character inside an already escaped value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder quoteEscapeCharacter(String quoteEscapeCharacter); /** *

* A value used to separate individual records from each other. *

* * @param recordDelimiter * A value used to separate individual records from each other. * @return Returns a reference to this object so that method calls can be chained together. */ Builder recordDelimiter(String recordDelimiter); /** *

* A value used to separate individual fields from each other within a record. *

* * @param fieldDelimiter * A value used to separate individual fields from each other within a record. * @return Returns a reference to this object so that method calls can be chained together. */ Builder fieldDelimiter(String fieldDelimiter); /** *

* A value used as an escape character where the field delimiter is part of the value. *

* * @param quoteCharacter * A value used as an escape character where the field delimiter is part of the value. * @return Returns a reference to this object so that method calls can be chained together. */ Builder quoteCharacter(String quoteCharacter); } static final class BuilderImpl implements Builder { private String fileHeaderInfo; private String comments; private String quoteEscapeCharacter; private String recordDelimiter; private String fieldDelimiter; private String quoteCharacter; private BuilderImpl() { } private BuilderImpl(CSVInput model) { fileHeaderInfo(model.fileHeaderInfo); comments(model.comments); quoteEscapeCharacter(model.quoteEscapeCharacter); recordDelimiter(model.recordDelimiter); fieldDelimiter(model.fieldDelimiter); quoteCharacter(model.quoteCharacter); } public final String getFileHeaderInfo() { return fileHeaderInfo; } public final void setFileHeaderInfo(String fileHeaderInfo) { this.fileHeaderInfo = fileHeaderInfo; } @Override public final Builder fileHeaderInfo(String fileHeaderInfo) { this.fileHeaderInfo = fileHeaderInfo; return this; } @Override public final Builder fileHeaderInfo(FileHeaderInfo fileHeaderInfo) { this.fileHeaderInfo(fileHeaderInfo == null ? null : fileHeaderInfo.toString()); return this; } public final String getComments() { return comments; } public final void setComments(String comments) { this.comments = comments; } @Override public final Builder comments(String comments) { this.comments = comments; return this; } public final String getQuoteEscapeCharacter() { return quoteEscapeCharacter; } public final void setQuoteEscapeCharacter(String quoteEscapeCharacter) { this.quoteEscapeCharacter = quoteEscapeCharacter; } @Override public final Builder quoteEscapeCharacter(String quoteEscapeCharacter) { this.quoteEscapeCharacter = quoteEscapeCharacter; return this; } public final String getRecordDelimiter() { return recordDelimiter; } public final void setRecordDelimiter(String recordDelimiter) { this.recordDelimiter = recordDelimiter; } @Override public final Builder recordDelimiter(String recordDelimiter) { this.recordDelimiter = recordDelimiter; return this; } public final String getFieldDelimiter() { return fieldDelimiter; } public final void setFieldDelimiter(String fieldDelimiter) { this.fieldDelimiter = fieldDelimiter; } @Override public final Builder fieldDelimiter(String fieldDelimiter) { this.fieldDelimiter = fieldDelimiter; return this; } public final String getQuoteCharacter() { return quoteCharacter; } public final void setQuoteCharacter(String quoteCharacter) { this.quoteCharacter = quoteCharacter; } @Override public final Builder quoteCharacter(String quoteCharacter) { this.quoteCharacter = quoteCharacter; return this; } @Override public CSVInput build() { return new CSVInput(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy