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

software.amazon.awssdk.services.athena.model.NamedQuery Maven / Gradle / Ivy

/*
 * Copyright 2014-2019 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.athena.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;

/**
 * 

* A query, where QueryString is the list of SQL query statements that comprise the query. *

*/ @Generated("software.amazon.awssdk:codegen") public final class NamedQuery implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(NamedQuery::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(NamedQuery::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build(); private static final SdkField DATABASE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(NamedQuery::database)).setter(setter(Builder::database)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Database").build()).build(); private static final SdkField QUERY_STRING_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(NamedQuery::queryString)).setter(setter(Builder::queryString)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryString").build()).build(); private static final SdkField NAMED_QUERY_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(NamedQuery::namedQueryId)).setter(setter(Builder::namedQueryId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NamedQueryId").build()).build(); private static final SdkField WORK_GROUP_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(NamedQuery::workGroup)).setter(setter(Builder::workGroup)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WorkGroup").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, DESCRIPTION_FIELD, DATABASE_FIELD, QUERY_STRING_FIELD, NAMED_QUERY_ID_FIELD, WORK_GROUP_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String description; private final String database; private final String queryString; private final String namedQueryId; private final String workGroup; private NamedQuery(BuilderImpl builder) { this.name = builder.name; this.description = builder.description; this.database = builder.database; this.queryString = builder.queryString; this.namedQueryId = builder.namedQueryId; this.workGroup = builder.workGroup; } /** *

* The query name. *

* * @return The query name. */ public String name() { return name; } /** *

* The query description. *

* * @return The query description. */ public String description() { return description; } /** *

* The database to which the query belongs. *

* * @return The database to which the query belongs. */ public String database() { return database; } /** *

* The SQL query statements that comprise the query. *

* * @return The SQL query statements that comprise the query. */ public String queryString() { return queryString; } /** *

* The unique identifier of the query. *

* * @return The unique identifier of the query. */ public String namedQueryId() { return namedQueryId; } /** *

* The name of the workgroup that contains the named query. *

* * @return The name of the workgroup that contains the named query. */ public String workGroup() { return workGroup; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(database()); hashCode = 31 * hashCode + Objects.hashCode(queryString()); hashCode = 31 * hashCode + Objects.hashCode(namedQueryId()); hashCode = 31 * hashCode + Objects.hashCode(workGroup()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof NamedQuery)) { return false; } NamedQuery other = (NamedQuery) obj; return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description()) && Objects.equals(database(), other.database()) && Objects.equals(queryString(), other.queryString()) && Objects.equals(namedQueryId(), other.namedQueryId()) && Objects.equals(workGroup(), other.workGroup()); } /** * 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 String toString() { return ToString.builder("NamedQuery").add("Name", name()).add("Description", description()).add("Database", database()) .add("QueryString", queryString()).add("NamedQueryId", namedQueryId()).add("WorkGroup", workGroup()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "Database": return Optional.ofNullable(clazz.cast(database())); case "QueryString": return Optional.ofNullable(clazz.cast(queryString())); case "NamedQueryId": return Optional.ofNullable(clazz.cast(namedQueryId())); case "WorkGroup": return Optional.ofNullable(clazz.cast(workGroup())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((NamedQuery) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The query name. *

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

* The query description. *

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

* The database to which the query belongs. *

* * @param database * The database to which the query belongs. * @return Returns a reference to this object so that method calls can be chained together. */ Builder database(String database); /** *

* The SQL query statements that comprise the query. *

* * @param queryString * The SQL query statements that comprise the query. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryString(String queryString); /** *

* The unique identifier of the query. *

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

* The name of the workgroup that contains the named query. *

* * @param workGroup * The name of the workgroup that contains the named query. * @return Returns a reference to this object so that method calls can be chained together. */ Builder workGroup(String workGroup); } static final class BuilderImpl implements Builder { private String name; private String description; private String database; private String queryString; private String namedQueryId; private String workGroup; private BuilderImpl() { } private BuilderImpl(NamedQuery model) { name(model.name); description(model.description); database(model.database); queryString(model.queryString); namedQueryId(model.namedQueryId); workGroup(model.workGroup); } 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 String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final String getDatabase() { return database; } @Override public final Builder database(String database) { this.database = database; return this; } public final void setDatabase(String database) { this.database = database; } public final String getQueryString() { return queryString; } @Override public final Builder queryString(String queryString) { this.queryString = queryString; return this; } public final void setQueryString(String queryString) { this.queryString = queryString; } public final String getNamedQueryId() { return namedQueryId; } @Override public final Builder namedQueryId(String namedQueryId) { this.namedQueryId = namedQueryId; return this; } public final void setNamedQueryId(String namedQueryId) { this.namedQueryId = namedQueryId; } public final String getWorkGroup() { return workGroup; } @Override public final Builder workGroup(String workGroup) { this.workGroup = workGroup; return this; } public final void setWorkGroup(String workGroup) { this.workGroup = workGroup; } @Override public NamedQuery build() { return new NamedQuery(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy