software.amazon.awssdk.services.m2.model.DatasetOrgAttributes Maven / Gradle / Ivy
Show all versions of m2 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.m2.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
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 DatasetOrgAttributes implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField GDG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("gdg").getter(getter(DatasetOrgAttributes::gdg)).setter(setter(Builder::gdg))
.constructor(GdgAttributes::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(DatasetOrgAttributes::po)).setter(setter(Builder::po))
.constructor(PoAttributes::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(DatasetOrgAttributes::ps)).setter(setter(Builder::ps))
.constructor(PsAttributes::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(DatasetOrgAttributes::vsam)).setter(setter(Builder::vsam))
.constructor(VsamAttributes::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 long serialVersionUID = 1L;
private final GdgAttributes gdg;
private final PoAttributes po;
private final PsAttributes ps;
private final VsamAttributes vsam;
private final Type type;
private DatasetOrgAttributes(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 GdgAttributes gdg() {
return gdg;
}
/**
*
* The details of a PO type data set.
*
*
* @return The details of a PO type data set.
*/
public final PoAttributes po() {
return po;
}
/**
*
* The details of a PS type data set.
*
*
* @return The details of a PS type data set.
*/
public final PsAttributes ps() {
return ps;
}
/**
*
* The details of a VSAM data set.
*
*
* @return The details of a VSAM data set.
*/
public final VsamAttributes 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 DatasetOrgAttributes)) {
return false;
}
DatasetOrgAttributes other = (DatasetOrgAttributes) 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("DatasetOrgAttributes").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 DatasetOrgAttributes fromGdg(GdgAttributes 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 DatasetOrgAttributes fromGdg(Consumer gdg) {
GdgAttributes.Builder builder = GdgAttributes.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 DatasetOrgAttributes fromPo(PoAttributes 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 DatasetOrgAttributes fromPo(Consumer po) {
PoAttributes.Builder builder = PoAttributes.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 DatasetOrgAttributes fromPs(PsAttributes 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 DatasetOrgAttributes fromPs(Consumer ps) {
PsAttributes.Builder builder = PsAttributes.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 DatasetOrgAttributes fromVsam(VsamAttributes 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 DatasetOrgAttributes fromVsam(Consumer vsam) {
VsamAttributes.Builder builder = VsamAttributes.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;
}
private static Function