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

software.amazon.awssdk.services.redshiftdata.model.ColumnMetadata Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.redshiftdata.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;

/**
 * 

* The properties (metadata) of a column. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ColumnMetadata implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField COLUMN_DEFAULT_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("columnDefault").getter(getter(ColumnMetadata::columnDefault)).setter(setter(Builder::columnDefault)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("columnDefault").build()).build(); private static final SdkField IS_CASE_SENSITIVE_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isCaseSensitive").getter(getter(ColumnMetadata::isCaseSensitive)) .setter(setter(Builder::isCaseSensitive)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isCaseSensitive").build()).build(); private static final SdkField IS_CURRENCY_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isCurrency").getter(getter(ColumnMetadata::isCurrency)).setter(setter(Builder::isCurrency)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isCurrency").build()).build(); private static final SdkField IS_SIGNED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .memberName("isSigned").getter(getter(ColumnMetadata::isSigned)).setter(setter(Builder::isSigned)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("isSigned").build()).build(); private static final SdkField LABEL_FIELD = SdkField. builder(MarshallingType.STRING).memberName("label") .getter(getter(ColumnMetadata::label)).setter(setter(Builder::label)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("label").build()).build(); private static final SdkField LENGTH_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("length").getter(getter(ColumnMetadata::length)).setter(setter(Builder::length)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("length").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("name") .getter(getter(ColumnMetadata::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build(); private static final SdkField NULLABLE_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("nullable").getter(getter(ColumnMetadata::nullable)).setter(setter(Builder::nullable)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("nullable").build()).build(); private static final SdkField PRECISION_FIELD = SdkField. builder(MarshallingType.INTEGER) .memberName("precision").getter(getter(ColumnMetadata::precision)).setter(setter(Builder::precision)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("precision").build()).build(); private static final SdkField SCALE_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("scale") .getter(getter(ColumnMetadata::scale)).setter(setter(Builder::scale)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("scale").build()).build(); private static final SdkField SCHEMA_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("schemaName").getter(getter(ColumnMetadata::schemaName)).setter(setter(Builder::schemaName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("schemaName").build()).build(); private static final SdkField TABLE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("tableName").getter(getter(ColumnMetadata::tableName)).setter(setter(Builder::tableName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tableName").build()).build(); private static final SdkField TYPE_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("typeName").getter(getter(ColumnMetadata::typeName)).setter(setter(Builder::typeName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("typeName").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(COLUMN_DEFAULT_FIELD, IS_CASE_SENSITIVE_FIELD, IS_CURRENCY_FIELD, IS_SIGNED_FIELD, LABEL_FIELD, LENGTH_FIELD, NAME_FIELD, NULLABLE_FIELD, PRECISION_FIELD, SCALE_FIELD, SCHEMA_NAME_FIELD, TABLE_NAME_FIELD, TYPE_NAME_FIELD)); private static final long serialVersionUID = 1L; private final String columnDefault; private final Boolean isCaseSensitive; private final Boolean isCurrency; private final Boolean isSigned; private final String label; private final Integer length; private final String name; private final Integer nullable; private final Integer precision; private final Integer scale; private final String schemaName; private final String tableName; private final String typeName; private ColumnMetadata(BuilderImpl builder) { this.columnDefault = builder.columnDefault; this.isCaseSensitive = builder.isCaseSensitive; this.isCurrency = builder.isCurrency; this.isSigned = builder.isSigned; this.label = builder.label; this.length = builder.length; this.name = builder.name; this.nullable = builder.nullable; this.precision = builder.precision; this.scale = builder.scale; this.schemaName = builder.schemaName; this.tableName = builder.tableName; this.typeName = builder.typeName; } /** *

* The default value of the column. *

* * @return The default value of the column. */ public final String columnDefault() { return columnDefault; } /** *

* A value that indicates whether the column is case-sensitive. *

* * @return A value that indicates whether the column is case-sensitive. */ public final Boolean isCaseSensitive() { return isCaseSensitive; } /** *

* A value that indicates whether the column contains currency values. *

* * @return A value that indicates whether the column contains currency values. */ public final Boolean isCurrency() { return isCurrency; } /** *

* A value that indicates whether an integer column is signed. *

* * @return A value that indicates whether an integer column is signed. */ public final Boolean isSigned() { return isSigned; } /** *

* The label for the column. *

* * @return The label for the column. */ public final String label() { return label; } /** *

* The length of the column. *

* * @return The length of the column. */ public final Integer length() { return length; } /** *

* The name of the column. *

* * @return The name of the column. */ public final String name() { return name; } /** *

* A value that indicates whether the column is nullable. *

* * @return A value that indicates whether the column is nullable. */ public final Integer nullable() { return nullable; } /** *

* The precision value of a decimal number column. *

* * @return The precision value of a decimal number column. */ public final Integer precision() { return precision; } /** *

* The scale value of a decimal number column. *

* * @return The scale value of a decimal number column. */ public final Integer scale() { return scale; } /** *

* The name of the schema that contains the table that includes the column. *

* * @return The name of the schema that contains the table that includes the column. */ public final String schemaName() { return schemaName; } /** *

* The name of the table that includes the column. *

* * @return The name of the table that includes the column. */ public final String tableName() { return tableName; } /** *

* The database-specific data type of the column. *

* * @return The database-specific data type of the column. */ public final String typeName() { return typeName; } @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(columnDefault()); hashCode = 31 * hashCode + Objects.hashCode(isCaseSensitive()); hashCode = 31 * hashCode + Objects.hashCode(isCurrency()); hashCode = 31 * hashCode + Objects.hashCode(isSigned()); hashCode = 31 * hashCode + Objects.hashCode(label()); hashCode = 31 * hashCode + Objects.hashCode(length()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(nullable()); hashCode = 31 * hashCode + Objects.hashCode(precision()); hashCode = 31 * hashCode + Objects.hashCode(scale()); hashCode = 31 * hashCode + Objects.hashCode(schemaName()); hashCode = 31 * hashCode + Objects.hashCode(tableName()); hashCode = 31 * hashCode + Objects.hashCode(typeName()); 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 ColumnMetadata)) { return false; } ColumnMetadata other = (ColumnMetadata) obj; return Objects.equals(columnDefault(), other.columnDefault()) && Objects.equals(isCaseSensitive(), other.isCaseSensitive()) && Objects.equals(isCurrency(), other.isCurrency()) && Objects.equals(isSigned(), other.isSigned()) && Objects.equals(label(), other.label()) && Objects.equals(length(), other.length()) && Objects.equals(name(), other.name()) && Objects.equals(nullable(), other.nullable()) && Objects.equals(precision(), other.precision()) && Objects.equals(scale(), other.scale()) && Objects.equals(schemaName(), other.schemaName()) && Objects.equals(tableName(), other.tableName()) && Objects.equals(typeName(), other.typeName()); } /** * 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("ColumnMetadata").add("ColumnDefault", columnDefault()).add("IsCaseSensitive", isCaseSensitive()) .add("IsCurrency", isCurrency()).add("IsSigned", isSigned()).add("Label", label()).add("Length", length()) .add("Name", name()).add("Nullable", nullable()).add("Precision", precision()).add("Scale", scale()) .add("SchemaName", schemaName()).add("TableName", tableName()).add("TypeName", typeName()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "columnDefault": return Optional.ofNullable(clazz.cast(columnDefault())); case "isCaseSensitive": return Optional.ofNullable(clazz.cast(isCaseSensitive())); case "isCurrency": return Optional.ofNullable(clazz.cast(isCurrency())); case "isSigned": return Optional.ofNullable(clazz.cast(isSigned())); case "label": return Optional.ofNullable(clazz.cast(label())); case "length": return Optional.ofNullable(clazz.cast(length())); case "name": return Optional.ofNullable(clazz.cast(name())); case "nullable": return Optional.ofNullable(clazz.cast(nullable())); case "precision": return Optional.ofNullable(clazz.cast(precision())); case "scale": return Optional.ofNullable(clazz.cast(scale())); case "schemaName": return Optional.ofNullable(clazz.cast(schemaName())); case "tableName": return Optional.ofNullable(clazz.cast(tableName())); case "typeName": return Optional.ofNullable(clazz.cast(typeName())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ColumnMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The default value of the column. *

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

* A value that indicates whether the column is case-sensitive. *

* * @param isCaseSensitive * A value that indicates whether the column is case-sensitive. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isCaseSensitive(Boolean isCaseSensitive); /** *

* A value that indicates whether the column contains currency values. *

* * @param isCurrency * A value that indicates whether the column contains currency values. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isCurrency(Boolean isCurrency); /** *

* A value that indicates whether an integer column is signed. *

* * @param isSigned * A value that indicates whether an integer column is signed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder isSigned(Boolean isSigned); /** *

* The label for the column. *

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

* The length of the column. *

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

* The name of the column. *

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

* A value that indicates whether the column is nullable. *

* * @param nullable * A value that indicates whether the column is nullable. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nullable(Integer nullable); /** *

* The precision value of a decimal number column. *

* * @param precision * The precision value of a decimal number column. * @return Returns a reference to this object so that method calls can be chained together. */ Builder precision(Integer precision); /** *

* The scale value of a decimal number column. *

* * @param scale * The scale value of a decimal number column. * @return Returns a reference to this object so that method calls can be chained together. */ Builder scale(Integer scale); /** *

* The name of the schema that contains the table that includes the column. *

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

* The name of the table that includes the column. *

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

* The database-specific data type of the column. *

* * @param typeName * The database-specific data type of the column. * @return Returns a reference to this object so that method calls can be chained together. */ Builder typeName(String typeName); } static final class BuilderImpl implements Builder { private String columnDefault; private Boolean isCaseSensitive; private Boolean isCurrency; private Boolean isSigned; private String label; private Integer length; private String name; private Integer nullable; private Integer precision; private Integer scale; private String schemaName; private String tableName; private String typeName; private BuilderImpl() { } private BuilderImpl(ColumnMetadata model) { columnDefault(model.columnDefault); isCaseSensitive(model.isCaseSensitive); isCurrency(model.isCurrency); isSigned(model.isSigned); label(model.label); length(model.length); name(model.name); nullable(model.nullable); precision(model.precision); scale(model.scale); schemaName(model.schemaName); tableName(model.tableName); typeName(model.typeName); } public final String getColumnDefault() { return columnDefault; } @Override public final Builder columnDefault(String columnDefault) { this.columnDefault = columnDefault; return this; } public final void setColumnDefault(String columnDefault) { this.columnDefault = columnDefault; } public final Boolean getIsCaseSensitive() { return isCaseSensitive; } @Override public final Builder isCaseSensitive(Boolean isCaseSensitive) { this.isCaseSensitive = isCaseSensitive; return this; } public final void setIsCaseSensitive(Boolean isCaseSensitive) { this.isCaseSensitive = isCaseSensitive; } public final Boolean getIsCurrency() { return isCurrency; } @Override public final Builder isCurrency(Boolean isCurrency) { this.isCurrency = isCurrency; return this; } public final void setIsCurrency(Boolean isCurrency) { this.isCurrency = isCurrency; } public final Boolean getIsSigned() { return isSigned; } @Override public final Builder isSigned(Boolean isSigned) { this.isSigned = isSigned; return this; } public final void setIsSigned(Boolean isSigned) { this.isSigned = isSigned; } public final String getLabel() { return label; } @Override public final Builder label(String label) { this.label = label; return this; } public final void setLabel(String label) { this.label = label; } public final Integer getLength() { return length; } @Override public final Builder length(Integer length) { this.length = length; return this; } public final void setLength(Integer length) { this.length = length; } 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 Integer getNullable() { return nullable; } @Override public final Builder nullable(Integer nullable) { this.nullable = nullable; return this; } public final void setNullable(Integer nullable) { this.nullable = nullable; } public final Integer getPrecision() { return precision; } @Override public final Builder precision(Integer precision) { this.precision = precision; return this; } public final void setPrecision(Integer precision) { this.precision = precision; } public final Integer getScale() { return scale; } @Override public final Builder scale(Integer scale) { this.scale = scale; return this; } public final void setScale(Integer scale) { this.scale = scale; } public final String getSchemaName() { return schemaName; } @Override public final Builder schemaName(String schemaName) { this.schemaName = schemaName; return this; } public final void setSchemaName(String schemaName) { this.schemaName = schemaName; } public final String getTableName() { return tableName; } @Override public final Builder tableName(String tableName) { this.tableName = tableName; return this; } public final void setTableName(String tableName) { this.tableName = tableName; } public final String getTypeName() { return typeName; } @Override public final Builder typeName(String typeName) { this.typeName = typeName; return this; } public final void setTypeName(String typeName) { this.typeName = typeName; } @Override public ColumnMetadata build() { return new ColumnMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy