software.amazon.awssdk.services.cleanrooms.model.AnalysisRuleIdMappingTable Maven / Gradle / Ivy
Show all versions of cleanrooms Show documentation
/*
* 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.cleanrooms.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Defines details for the analysis rule ID mapping table.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class AnalysisRuleIdMappingTable implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField> JOIN_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("joinColumns")
.getter(getter(AnalysisRuleIdMappingTable::joinColumns))
.setter(setter(Builder::joinColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("joinColumns").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> QUERY_CONSTRAINTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("queryConstraints")
.getter(getter(AnalysisRuleIdMappingTable::queryConstraints))
.setter(setter(Builder::queryConstraints))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("queryConstraints").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(QueryConstraint::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> DIMENSION_COLUMNS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("dimensionColumns")
.getter(getter(AnalysisRuleIdMappingTable::dimensionColumns))
.setter(setter(Builder::dimensionColumns))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dimensionColumns").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOIN_COLUMNS_FIELD,
QUERY_CONSTRAINTS_FIELD, DIMENSION_COLUMNS_FIELD));
private static final long serialVersionUID = 1L;
private final List joinColumns;
private final List queryConstraints;
private final List dimensionColumns;
private AnalysisRuleIdMappingTable(BuilderImpl builder) {
this.joinColumns = builder.joinColumns;
this.queryConstraints = builder.queryConstraints;
this.dimensionColumns = builder.dimensionColumns;
}
/**
* For responses, this returns true if the service returned a value for the JoinColumns property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasJoinColumns() {
return joinColumns != null && !(joinColumns instanceof SdkAutoConstructList);
}
/**
*
* The columns that query runners are allowed to use in an INNER JOIN statement.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasJoinColumns} method.
*
*
* @return The columns that query runners are allowed to use in an INNER JOIN statement.
*/
public final List joinColumns() {
return joinColumns;
}
/**
* For responses, this returns true if the service returned a value for the QueryConstraints property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasQueryConstraints() {
return queryConstraints != null && !(queryConstraints instanceof SdkAutoConstructList);
}
/**
*
* The query constraints of the analysis rule ID mapping table.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasQueryConstraints} method.
*
*
* @return The query constraints of the analysis rule ID mapping table.
*/
public final List queryConstraints() {
return queryConstraints;
}
/**
* For responses, this returns true if the service returned a value for the DimensionColumns property. This DOES NOT
* check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasDimensionColumns() {
return dimensionColumns != null && !(dimensionColumns instanceof SdkAutoConstructList);
}
/**
*
* The columns that query runners are allowed to select, group by, or filter by.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasDimensionColumns} method.
*
*
* @return The columns that query runners are allowed to select, group by, or filter by.
*/
public final List dimensionColumns() {
return dimensionColumns;
}
@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(hasJoinColumns() ? joinColumns() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasQueryConstraints() ? queryConstraints() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasDimensionColumns() ? dimensionColumns() : null);
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 AnalysisRuleIdMappingTable)) {
return false;
}
AnalysisRuleIdMappingTable other = (AnalysisRuleIdMappingTable) obj;
return hasJoinColumns() == other.hasJoinColumns() && Objects.equals(joinColumns(), other.joinColumns())
&& hasQueryConstraints() == other.hasQueryConstraints()
&& Objects.equals(queryConstraints(), other.queryConstraints())
&& hasDimensionColumns() == other.hasDimensionColumns()
&& Objects.equals(dimensionColumns(), other.dimensionColumns());
}
/**
* 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("AnalysisRuleIdMappingTable").add("JoinColumns", hasJoinColumns() ? joinColumns() : null)
.add("QueryConstraints", hasQueryConstraints() ? queryConstraints() : null)
.add("DimensionColumns", hasDimensionColumns() ? dimensionColumns() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "joinColumns":
return Optional.ofNullable(clazz.cast(joinColumns()));
case "queryConstraints":
return Optional.ofNullable(clazz.cast(queryConstraints()));
case "dimensionColumns":
return Optional.ofNullable(clazz.cast(dimensionColumns()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function