
software.amazon.awssdk.services.quicksight.model.JoinInstruction Maven / Gradle / Ivy
/*
* 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.quicksight.model;
import java.beans.Transient;
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.Consumer;
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 instructions associated with a join.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JoinInstruction implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField LEFT_OPERAND_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LeftOperand").getter(getter(JoinInstruction::leftOperand)).setter(setter(Builder::leftOperand))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LeftOperand").build()).build();
private static final SdkField RIGHT_OPERAND_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RightOperand").getter(getter(JoinInstruction::rightOperand)).setter(setter(Builder::rightOperand))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RightOperand").build()).build();
private static final SdkField LEFT_JOIN_KEY_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("LeftJoinKeyProperties")
.getter(getter(JoinInstruction::leftJoinKeyProperties)).setter(setter(Builder::leftJoinKeyProperties))
.constructor(JoinKeyProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LeftJoinKeyProperties").build())
.build();
private static final SdkField RIGHT_JOIN_KEY_PROPERTIES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RightJoinKeyProperties")
.getter(getter(JoinInstruction::rightJoinKeyProperties)).setter(setter(Builder::rightJoinKeyProperties))
.constructor(JoinKeyProperties::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RightJoinKeyProperties").build())
.build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(JoinInstruction::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final SdkField ON_CLAUSE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OnClause").getter(getter(JoinInstruction::onClause)).setter(setter(Builder::onClause))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OnClause").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LEFT_OPERAND_FIELD,
RIGHT_OPERAND_FIELD, LEFT_JOIN_KEY_PROPERTIES_FIELD, RIGHT_JOIN_KEY_PROPERTIES_FIELD, TYPE_FIELD, ON_CLAUSE_FIELD));
private static final long serialVersionUID = 1L;
private final String leftOperand;
private final String rightOperand;
private final JoinKeyProperties leftJoinKeyProperties;
private final JoinKeyProperties rightJoinKeyProperties;
private final String type;
private final String onClause;
private JoinInstruction(BuilderImpl builder) {
this.leftOperand = builder.leftOperand;
this.rightOperand = builder.rightOperand;
this.leftJoinKeyProperties = builder.leftJoinKeyProperties;
this.rightJoinKeyProperties = builder.rightJoinKeyProperties;
this.type = builder.type;
this.onClause = builder.onClause;
}
/**
*
* The operand on the left side of a join.
*
*
* @return The operand on the left side of a join.
*/
public final String leftOperand() {
return leftOperand;
}
/**
*
* The operand on the right side of a join.
*
*
* @return The operand on the right side of a join.
*/
public final String rightOperand() {
return rightOperand;
}
/**
*
* Join key properties of the left operand.
*
*
* @return Join key properties of the left operand.
*/
public final JoinKeyProperties leftJoinKeyProperties() {
return leftJoinKeyProperties;
}
/**
*
* Join key properties of the right operand.
*
*
* @return Join key properties of the right operand.
*/
public final JoinKeyProperties rightJoinKeyProperties() {
return rightJoinKeyProperties;
}
/**
*
* The type of join that it is.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link JoinType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of join that it is.
* @see JoinType
*/
public final JoinType type() {
return JoinType.fromValue(type);
}
/**
*
* The type of join that it is.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link JoinType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The type of join that it is.
* @see JoinType
*/
public final String typeAsString() {
return type;
}
/**
*
* The join instructions provided in the ON
clause of a join.
*
*
* @return The join instructions provided in the ON
clause of a join.
*/
public final String onClause() {
return onClause;
}
@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(leftOperand());
hashCode = 31 * hashCode + Objects.hashCode(rightOperand());
hashCode = 31 * hashCode + Objects.hashCode(leftJoinKeyProperties());
hashCode = 31 * hashCode + Objects.hashCode(rightJoinKeyProperties());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(onClause());
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 JoinInstruction)) {
return false;
}
JoinInstruction other = (JoinInstruction) obj;
return Objects.equals(leftOperand(), other.leftOperand()) && Objects.equals(rightOperand(), other.rightOperand())
&& Objects.equals(leftJoinKeyProperties(), other.leftJoinKeyProperties())
&& Objects.equals(rightJoinKeyProperties(), other.rightJoinKeyProperties())
&& Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(onClause(), other.onClause());
}
/**
* 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("JoinInstruction").add("LeftOperand", leftOperand()).add("RightOperand", rightOperand())
.add("LeftJoinKeyProperties", leftJoinKeyProperties()).add("RightJoinKeyProperties", rightJoinKeyProperties())
.add("Type", typeAsString()).add("OnClause", onClause()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "LeftOperand":
return Optional.ofNullable(clazz.cast(leftOperand()));
case "RightOperand":
return Optional.ofNullable(clazz.cast(rightOperand()));
case "LeftJoinKeyProperties":
return Optional.ofNullable(clazz.cast(leftJoinKeyProperties()));
case "RightJoinKeyProperties":
return Optional.ofNullable(clazz.cast(rightJoinKeyProperties()));
case "Type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "OnClause":
return Optional.ofNullable(clazz.cast(onClause()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function