software.amazon.awssdk.services.mediaconvert.model.PresetSettings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mediaconvert Show documentation
Show all versions of mediaconvert Show documentation
The AWS Java SDK for AWS Elemental MediaConvert module holds the client classes that are used for
communicating
with AWS Elemental MediaConvert Service
/*
* 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.mediaconvert.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
* Settings for preset
*/
@Generated("software.amazon.awssdk:codegen")
public final class PresetSettings implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField> AUDIO_DESCRIPTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("AudioDescriptions")
.getter(getter(PresetSettings::audioDescriptions))
.setter(setter(Builder::audioDescriptions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("audioDescriptions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(AudioDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> CAPTION_DESCRIPTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("CaptionDescriptions")
.getter(getter(PresetSettings::captionDescriptions))
.setter(setter(Builder::captionDescriptions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("captionDescriptions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(CaptionDescriptionPreset::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField CONTAINER_SETTINGS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ContainerSettings")
.getter(getter(PresetSettings::containerSettings)).setter(setter(Builder::containerSettings))
.constructor(ContainerSettings::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containerSettings").build()).build();
private static final SdkField VIDEO_DESCRIPTION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("VideoDescription")
.getter(getter(PresetSettings::videoDescription)).setter(setter(Builder::videoDescription))
.constructor(VideoDescription::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("videoDescription").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(AUDIO_DESCRIPTIONS_FIELD,
CAPTION_DESCRIPTIONS_FIELD, CONTAINER_SETTINGS_FIELD, VIDEO_DESCRIPTION_FIELD));
private static final long serialVersionUID = 1L;
private final List audioDescriptions;
private final List captionDescriptions;
private final ContainerSettings containerSettings;
private final VideoDescription videoDescription;
private PresetSettings(BuilderImpl builder) {
this.audioDescriptions = builder.audioDescriptions;
this.captionDescriptions = builder.captionDescriptions;
this.containerSettings = builder.containerSettings;
this.videoDescription = builder.videoDescription;
}
/**
* For responses, this returns true if the service returned a value for the AudioDescriptions property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasAudioDescriptions() {
return audioDescriptions != null && !(audioDescriptions instanceof SdkAutoConstructList);
}
/**
* Contains groups of audio encoding settings organized by audio codec. Include one instance of per output. Can
* contain multiple groups of encoding settings.
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasAudioDescriptions} method.
*
*
* @return Contains groups of audio encoding settings organized by audio codec. Include one instance of per output.
* Can contain multiple groups of encoding settings.
*/
public final List audioDescriptions() {
return audioDescriptions;
}
/**
* For responses, this returns true if the service returned a value for the CaptionDescriptions property. This DOES
* NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property).
* This is useful because the SDK will never return a null collection or map, but you may need to differentiate
* between the service returning nothing (or null) and the service returning an empty collection or map. For
* requests, this returns true if a value for the property was specified in the request builder, and false if a
* value was not specified.
*/
public final boolean hasCaptionDescriptions() {
return captionDescriptions != null && !(captionDescriptions instanceof SdkAutoConstructList);
}
/**
* This object holds groups of settings related to captions for one output. For each output that has captions,
* include one instance of CaptionDescriptions.
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasCaptionDescriptions} method.
*
*
* @return This object holds groups of settings related to captions for one output. For each output that has
* captions, include one instance of CaptionDescriptions.
*/
public final List captionDescriptions() {
return captionDescriptions;
}
/**
* Container specific settings.
*
* @return Container specific settings.
*/
public final ContainerSettings containerSettings() {
return containerSettings;
}
/**
* VideoDescription contains a group of video encoding settings. The specific video settings depend on the video
* codec that you choose for the property codec. Include one instance of VideoDescription per output.
*
* @return VideoDescription contains a group of video encoding settings. The specific video settings depend on the
* video codec that you choose for the property codec. Include one instance of VideoDescription per output.
*/
public final VideoDescription videoDescription() {
return videoDescription;
}
@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(hasAudioDescriptions() ? audioDescriptions() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasCaptionDescriptions() ? captionDescriptions() : null);
hashCode = 31 * hashCode + Objects.hashCode(containerSettings());
hashCode = 31 * hashCode + Objects.hashCode(videoDescription());
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 PresetSettings)) {
return false;
}
PresetSettings other = (PresetSettings) obj;
return hasAudioDescriptions() == other.hasAudioDescriptions()
&& Objects.equals(audioDescriptions(), other.audioDescriptions())
&& hasCaptionDescriptions() == other.hasCaptionDescriptions()
&& Objects.equals(captionDescriptions(), other.captionDescriptions())
&& Objects.equals(containerSettings(), other.containerSettings())
&& Objects.equals(videoDescription(), other.videoDescription());
}
/**
* 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("PresetSettings").add("AudioDescriptions", hasAudioDescriptions() ? audioDescriptions() : null)
.add("CaptionDescriptions", hasCaptionDescriptions() ? captionDescriptions() : null)
.add("ContainerSettings", containerSettings()).add("VideoDescription", videoDescription()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AudioDescriptions":
return Optional.ofNullable(clazz.cast(audioDescriptions()));
case "CaptionDescriptions":
return Optional.ofNullable(clazz.cast(captionDescriptions()));
case "ContainerSettings":
return Optional.ofNullable(clazz.cast(containerSettings()));
case "VideoDescription":
return Optional.ofNullable(clazz.cast(videoDescription()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function