software.amazon.awssdk.services.m2.model.DatasetDetailOrgAttributes 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.m2.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
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.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Additional details about the data set. Different attributes correspond to different data set organizations. The
* values are populated based on datasetOrg, storageType and backend (Blu Age or Micro Focus).
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DatasetDetailOrgAttributes implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField GDG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("gdg")
.getter(getter(DatasetDetailOrgAttributes::gdg)).setter(setter(Builder::gdg))
.constructor(GdgDetailAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("gdg").build()).build();
private static final SdkField PO_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("po").getter(getter(DatasetDetailOrgAttributes::po)).setter(setter(Builder::po))
.constructor(PoDetailAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("po").build()).build();
private static final SdkField PS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("ps").getter(getter(DatasetDetailOrgAttributes::ps)).setter(setter(Builder::ps))
.constructor(PsDetailAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ps").build()).build();
private static final SdkField VSAM_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("vsam")
.getter(getter(DatasetDetailOrgAttributes::vsam)).setter(setter(Builder::vsam))
.constructor(VsamDetailAttributes::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vsam").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(GDG_FIELD, PO_FIELD, PS_FIELD,
VSAM_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final GdgDetailAttributes gdg;
private final PoDetailAttributes po;
private final PsDetailAttributes ps;
private final VsamDetailAttributes vsam;
private final Type type;
private DatasetDetailOrgAttributes(BuilderImpl builder) {
this.gdg = builder.gdg;
this.po = builder.po;
this.ps = builder.ps;
this.vsam = builder.vsam;
this.type = builder.type;
}
/**
*
* The generation data group of the data set.
*
*
* @return The generation data group of the data set.
*/
public final GdgDetailAttributes gdg() {
return gdg;
}
/**
*
* The details of a PO type data set.
*
*
* @return The details of a PO type data set.
*/
public final PoDetailAttributes po() {
return po;
}
/**
*
* The details of a PS type data set.
*
*
* @return The details of a PS type data set.
*/
public final PsDetailAttributes ps() {
return ps;
}
/**
*
* The details of a VSAM data set.
*
*
* @return The details of a VSAM data set.
*/
public final VsamDetailAttributes vsam() {
return vsam;
}
@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(gdg());
hashCode = 31 * hashCode + Objects.hashCode(po());
hashCode = 31 * hashCode + Objects.hashCode(ps());
hashCode = 31 * hashCode + Objects.hashCode(vsam());
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 DatasetDetailOrgAttributes)) {
return false;
}
DatasetDetailOrgAttributes other = (DatasetDetailOrgAttributes) obj;
return Objects.equals(gdg(), other.gdg()) && Objects.equals(po(), other.po()) && Objects.equals(ps(), other.ps())
&& Objects.equals(vsam(), other.vsam());
}
/**
* 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("DatasetDetailOrgAttributes").add("Gdg", gdg()).add("Po", po()).add("Ps", ps())
.add("Vsam", vsam()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "gdg":
return Optional.ofNullable(clazz.cast(gdg()));
case "po":
return Optional.ofNullable(clazz.cast(po()));
case "ps":
return Optional.ofNullable(clazz.cast(ps()));
case "vsam":
return Optional.ofNullable(clazz.cast(vsam()));
default:
return Optional.empty();
}
}
/**
* Create an instance of this class with {@link #gdg()} initialized to the given value.
*
*
* The generation data group of the data set.
*
*
* @param gdg
* The generation data group of the data set.
*/
public static DatasetDetailOrgAttributes fromGdg(GdgDetailAttributes gdg) {
return builder().gdg(gdg).build();
}
/**
* Create an instance of this class with {@link #gdg()} initialized to the given value.
*
*
* The generation data group of the data set.
*
*
* @param gdg
* The generation data group of the data set.
*/
public static DatasetDetailOrgAttributes fromGdg(Consumer gdg) {
GdgDetailAttributes.Builder builder = GdgDetailAttributes.builder();
gdg.accept(builder);
return fromGdg(builder.build());
}
/**
* Create an instance of this class with {@link #po()} initialized to the given value.
*
*
* The details of a PO type data set.
*
*
* @param po
* The details of a PO type data set.
*/
public static DatasetDetailOrgAttributes fromPo(PoDetailAttributes po) {
return builder().po(po).build();
}
/**
* Create an instance of this class with {@link #po()} initialized to the given value.
*
*
* The details of a PO type data set.
*
*
* @param po
* The details of a PO type data set.
*/
public static DatasetDetailOrgAttributes fromPo(Consumer po) {
PoDetailAttributes.Builder builder = PoDetailAttributes.builder();
po.accept(builder);
return fromPo(builder.build());
}
/**
* Create an instance of this class with {@link #ps()} initialized to the given value.
*
*
* The details of a PS type data set.
*
*
* @param ps
* The details of a PS type data set.
*/
public static DatasetDetailOrgAttributes fromPs(PsDetailAttributes ps) {
return builder().ps(ps).build();
}
/**
* Create an instance of this class with {@link #ps()} initialized to the given value.
*
*
* The details of a PS type data set.
*
*
* @param ps
* The details of a PS type data set.
*/
public static DatasetDetailOrgAttributes fromPs(Consumer ps) {
PsDetailAttributes.Builder builder = PsDetailAttributes.builder();
ps.accept(builder);
return fromPs(builder.build());
}
/**
* Create an instance of this class with {@link #vsam()} initialized to the given value.
*
*
* The details of a VSAM data set.
*
*
* @param vsam
* The details of a VSAM data set.
*/
public static DatasetDetailOrgAttributes fromVsam(VsamDetailAttributes vsam) {
return builder().vsam(vsam).build();
}
/**
* Create an instance of this class with {@link #vsam()} initialized to the given value.
*
*
* The details of a VSAM data set.
*
*
* @param vsam
* The details of a VSAM data set.
*/
public static DatasetDetailOrgAttributes fromVsam(Consumer vsam) {
VsamDetailAttributes.Builder builder = VsamDetailAttributes.builder();
vsam.accept(builder);
return fromVsam(builder.build());
}
/**
* Retrieve an enum value representing which member of this object is populated.
*
* When this class is returned in a service response, this will be {@link Type#UNKNOWN_TO_SDK_VERSION} if the
* service returned a member that is only known to a newer SDK version.
*
* When this class is created directly in your code, this will be {@link Type#UNKNOWN_TO_SDK_VERSION} if zero
* members are set, and {@code null} if more than one member is set.
*/
public Type type() {
return type;
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("gdg", GDG_FIELD);
map.put("po", PO_FIELD);
map.put("ps", PS_FIELD);
map.put("vsam", VSAM_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function