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

software.amazon.awssdk.services.mediaconvert.model.PresetSettings Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Elemental MediaConvert module holds the client classes that are used for communicating with AWS Elemental MediaConvert Service

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((PresetSettings) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** * Contains groups of audio encoding settings organized by audio codec. Include one instance of per output. Can * contain multiple groups of encoding settings. * * @param audioDescriptions * Contains groups of audio encoding settings organized by audio codec. Include one instance of per * output. Can contain multiple groups of encoding settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder audioDescriptions(Collection audioDescriptions); /** * Contains groups of audio encoding settings organized by audio codec. Include one instance of per output. Can * contain multiple groups of encoding settings. * * @param audioDescriptions * Contains groups of audio encoding settings organized by audio codec. Include one instance of per * output. Can contain multiple groups of encoding settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder audioDescriptions(AudioDescription... audioDescriptions); /** * Contains groups of audio encoding settings organized by audio codec. Include one instance of per output. Can * contain multiple groups of encoding settings. This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.mediaconvert.model.AudioDescription.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.mediaconvert.model.AudioDescription#builder()} * . * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.mediaconvert.model.AudioDescription.Builder#build()} is called * immediately and its result is passed to {@link #audioDescriptions(List)}. * * @param audioDescriptions * a consumer that will call methods on * {@link software.amazon.awssdk.services.mediaconvert.model.AudioDescription.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #audioDescriptions(java.util.Collection) */ Builder audioDescriptions(Consumer... audioDescriptions); /** * This object holds groups of settings related to captions for one output. For each output that has captions, * include one instance of CaptionDescriptions. * * @param captionDescriptions * This object holds groups of settings related to captions for one output. For each output that has * captions, include one instance of CaptionDescriptions. * @return Returns a reference to this object so that method calls can be chained together. */ Builder captionDescriptions(Collection captionDescriptions); /** * This object holds groups of settings related to captions for one output. For each output that has captions, * include one instance of CaptionDescriptions. * * @param captionDescriptions * This object holds groups of settings related to captions for one output. For each output that has * captions, include one instance of CaptionDescriptions. * @return Returns a reference to this object so that method calls can be chained together. */ Builder captionDescriptions(CaptionDescriptionPreset... captionDescriptions); /** * This object holds groups of settings related to captions for one output. For each output that has captions, * include one instance of CaptionDescriptions. This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.mediaconvert.model.CaptionDescriptionPreset.Builder} avoiding the need * to create one manually via * {@link software.amazon.awssdk.services.mediaconvert.model.CaptionDescriptionPreset#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.mediaconvert.model.CaptionDescriptionPreset.Builder#build()} is called * immediately and its result is passed to {@link #captionDescriptions(List)}. * * @param captionDescriptions * a consumer that will call methods on * {@link software.amazon.awssdk.services.mediaconvert.model.CaptionDescriptionPreset.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #captionDescriptions(java.util.Collection) */ Builder captionDescriptions(Consumer... captionDescriptions); /** * Container specific settings. * * @param containerSettings * Container specific settings. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containerSettings(ContainerSettings containerSettings); /** * Container specific settings. This is a convenience method that creates an instance of the * {@link ContainerSettings.Builder} avoiding the need to create one manually via * {@link ContainerSettings#builder()}. * *

* When the {@link Consumer} completes, {@link ContainerSettings.Builder#build()} is called immediately and its * result is passed to {@link #containerSettings(ContainerSettings)}. * * @param containerSettings * a consumer that will call methods on {@link ContainerSettings.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #containerSettings(ContainerSettings) */ default Builder containerSettings(Consumer containerSettings) { return containerSettings(ContainerSettings.builder().applyMutation(containerSettings).build()); } /** * 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. * * @param videoDescription * 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 Returns a reference to this object so that method calls can be chained together. */ Builder videoDescription(VideoDescription videoDescription); /** * 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. This is a * convenience method that creates an instance of the {@link VideoDescription.Builder} avoiding the need to * create one manually via {@link VideoDescription#builder()}. * *

* When the {@link Consumer} completes, {@link VideoDescription.Builder#build()} is called immediately and its * result is passed to {@link #videoDescription(VideoDescription)}. * * @param videoDescription * a consumer that will call methods on {@link VideoDescription.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #videoDescription(VideoDescription) */ default Builder videoDescription(Consumer videoDescription) { return videoDescription(VideoDescription.builder().applyMutation(videoDescription).build()); } } static final class BuilderImpl implements Builder { private List audioDescriptions = DefaultSdkAutoConstructList.getInstance(); private List captionDescriptions = DefaultSdkAutoConstructList.getInstance(); private ContainerSettings containerSettings; private VideoDescription videoDescription; private BuilderImpl() { } private BuilderImpl(PresetSettings model) { audioDescriptions(model.audioDescriptions); captionDescriptions(model.captionDescriptions); containerSettings(model.containerSettings); videoDescription(model.videoDescription); } public final List getAudioDescriptions() { List result = ___listOfAudioDescriptionCopier.copyToBuilder(this.audioDescriptions); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setAudioDescriptions(Collection audioDescriptions) { this.audioDescriptions = ___listOfAudioDescriptionCopier.copyFromBuilder(audioDescriptions); } @Override public final Builder audioDescriptions(Collection audioDescriptions) { this.audioDescriptions = ___listOfAudioDescriptionCopier.copy(audioDescriptions); return this; } @Override @SafeVarargs public final Builder audioDescriptions(AudioDescription... audioDescriptions) { audioDescriptions(Arrays.asList(audioDescriptions)); return this; } @Override @SafeVarargs public final Builder audioDescriptions(Consumer... audioDescriptions) { audioDescriptions(Stream.of(audioDescriptions).map(c -> AudioDescription.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final List getCaptionDescriptions() { List result = ___listOfCaptionDescriptionPresetCopier .copyToBuilder(this.captionDescriptions); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setCaptionDescriptions(Collection captionDescriptions) { this.captionDescriptions = ___listOfCaptionDescriptionPresetCopier.copyFromBuilder(captionDescriptions); } @Override public final Builder captionDescriptions(Collection captionDescriptions) { this.captionDescriptions = ___listOfCaptionDescriptionPresetCopier.copy(captionDescriptions); return this; } @Override @SafeVarargs public final Builder captionDescriptions(CaptionDescriptionPreset... captionDescriptions) { captionDescriptions(Arrays.asList(captionDescriptions)); return this; } @Override @SafeVarargs public final Builder captionDescriptions(Consumer... captionDescriptions) { captionDescriptions(Stream.of(captionDescriptions) .map(c -> CaptionDescriptionPreset.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final ContainerSettings.Builder getContainerSettings() { return containerSettings != null ? containerSettings.toBuilder() : null; } public final void setContainerSettings(ContainerSettings.BuilderImpl containerSettings) { this.containerSettings = containerSettings != null ? containerSettings.build() : null; } @Override public final Builder containerSettings(ContainerSettings containerSettings) { this.containerSettings = containerSettings; return this; } public final VideoDescription.Builder getVideoDescription() { return videoDescription != null ? videoDescription.toBuilder() : null; } public final void setVideoDescription(VideoDescription.BuilderImpl videoDescription) { this.videoDescription = videoDescription != null ? videoDescription.build() : null; } @Override public final Builder videoDescription(VideoDescription videoDescription) { this.videoDescription = videoDescription; return this; } @Override public PresetSettings build() { return new PresetSettings(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy