software.amazon.awssdk.services.glue.model.Statement Maven / Gradle / Ivy
Show all versions of glue 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.glue.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.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 statement or request for a particular action to occur in a session.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Statement implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.INTEGER).memberName("Id")
.getter(getter(Statement::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField CODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Code")
.getter(getter(Statement::code)).setter(setter(Builder::code))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Code").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(Statement::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField OUTPUT_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Output").getter(getter(Statement::output)).setter(setter(Builder::output))
.constructor(StatementOutput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Output").build()).build();
private static final SdkField PROGRESS_FIELD = SdkField. builder(MarshallingType.DOUBLE)
.memberName("Progress").getter(getter(Statement::progress)).setter(setter(Builder::progress))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Progress").build()).build();
private static final SdkField STARTED_ON_FIELD = SdkField. builder(MarshallingType.LONG).memberName("StartedOn")
.getter(getter(Statement::startedOn)).setter(setter(Builder::startedOn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartedOn").build()).build();
private static final SdkField COMPLETED_ON_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("CompletedOn").getter(getter(Statement::completedOn)).setter(setter(Builder::completedOn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletedOn").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, CODE_FIELD,
STATE_FIELD, OUTPUT_FIELD, PROGRESS_FIELD, STARTED_ON_FIELD, COMPLETED_ON_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Id", ID_FIELD);
put("Code", CODE_FIELD);
put("State", STATE_FIELD);
put("Output", OUTPUT_FIELD);
put("Progress", PROGRESS_FIELD);
put("StartedOn", STARTED_ON_FIELD);
put("CompletedOn", COMPLETED_ON_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final Integer id;
private final String code;
private final String state;
private final StatementOutput output;
private final Double progress;
private final Long startedOn;
private final Long completedOn;
private Statement(BuilderImpl builder) {
this.id = builder.id;
this.code = builder.code;
this.state = builder.state;
this.output = builder.output;
this.progress = builder.progress;
this.startedOn = builder.startedOn;
this.completedOn = builder.completedOn;
}
/**
*
* The ID of the statement.
*
*
* @return The ID of the statement.
*/
public final Integer id() {
return id;
}
/**
*
* The execution code of the statement.
*
*
* @return The execution code of the statement.
*/
public final String code() {
return code;
}
/**
*
* The state while request is actioned.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link StatementState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state while request is actioned.
* @see StatementState
*/
public final StatementState state() {
return StatementState.fromValue(state);
}
/**
*
* The state while request is actioned.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link StatementState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The state while request is actioned.
* @see StatementState
*/
public final String stateAsString() {
return state;
}
/**
*
* The output in JSON.
*
*
* @return The output in JSON.
*/
public final StatementOutput output() {
return output;
}
/**
*
* The code execution progress.
*
*
* @return The code execution progress.
*/
public final Double progress() {
return progress;
}
/**
*
* The unix time and date that the job definition was started.
*
*
* @return The unix time and date that the job definition was started.
*/
public final Long startedOn() {
return startedOn;
}
/**
*
* The unix time and date that the job definition was completed.
*
*
* @return The unix time and date that the job definition was completed.
*/
public final Long completedOn() {
return completedOn;
}
@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(id());
hashCode = 31 * hashCode + Objects.hashCode(code());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(output());
hashCode = 31 * hashCode + Objects.hashCode(progress());
hashCode = 31 * hashCode + Objects.hashCode(startedOn());
hashCode = 31 * hashCode + Objects.hashCode(completedOn());
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 Statement)) {
return false;
}
Statement other = (Statement) obj;
return Objects.equals(id(), other.id()) && Objects.equals(code(), other.code())
&& Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(output(), other.output())
&& Objects.equals(progress(), other.progress()) && Objects.equals(startedOn(), other.startedOn())
&& Objects.equals(completedOn(), other.completedOn());
}
/**
* 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("Statement").add("Id", id()).add("Code", code()).add("State", stateAsString())
.add("Output", output()).add("Progress", progress()).add("StartedOn", startedOn())
.add("CompletedOn", completedOn()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Code":
return Optional.ofNullable(clazz.cast(code()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "Output":
return Optional.ofNullable(clazz.cast(output()));
case "Progress":
return Optional.ofNullable(clazz.cast(progress()));
case "StartedOn":
return Optional.ofNullable(clazz.cast(startedOn()));
case "CompletedOn":
return Optional.ofNullable(clazz.cast(completedOn()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function