software.amazon.awssdk.services.elastictranscoder.model.Thumbnails Maven / Gradle / Ivy
Show all versions of elastictranscoder 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.elastictranscoder.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;
/**
*
* Thumbnails for videos.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Thumbnails implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Format")
.getter(getter(Thumbnails::format)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build();
private static final SdkField INTERVAL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Interval").getter(getter(Thumbnails::interval)).setter(setter(Builder::interval))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Interval").build()).build();
private static final SdkField RESOLUTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Resolution").getter(getter(Thumbnails::resolution)).setter(setter(Builder::resolution))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Resolution").build()).build();
private static final SdkField ASPECT_RATIO_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AspectRatio").getter(getter(Thumbnails::aspectRatio)).setter(setter(Builder::aspectRatio))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AspectRatio").build()).build();
private static final SdkField MAX_WIDTH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MaxWidth").getter(getter(Thumbnails::maxWidth)).setter(setter(Builder::maxWidth))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxWidth").build()).build();
private static final SdkField MAX_HEIGHT_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MaxHeight").getter(getter(Thumbnails::maxHeight)).setter(setter(Builder::maxHeight))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxHeight").build()).build();
private static final SdkField SIZING_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SizingPolicy").getter(getter(Thumbnails::sizingPolicy)).setter(setter(Builder::sizingPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SizingPolicy").build()).build();
private static final SdkField PADDING_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("PaddingPolicy").getter(getter(Thumbnails::paddingPolicy)).setter(setter(Builder::paddingPolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PaddingPolicy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FORMAT_FIELD, INTERVAL_FIELD,
RESOLUTION_FIELD, ASPECT_RATIO_FIELD, MAX_WIDTH_FIELD, MAX_HEIGHT_FIELD, SIZING_POLICY_FIELD, PADDING_POLICY_FIELD));
private static final long serialVersionUID = 1L;
private final String format;
private final String interval;
private final String resolution;
private final String aspectRatio;
private final String maxWidth;
private final String maxHeight;
private final String sizingPolicy;
private final String paddingPolicy;
private Thumbnails(BuilderImpl builder) {
this.format = builder.format;
this.interval = builder.interval;
this.resolution = builder.resolution;
this.aspectRatio = builder.aspectRatio;
this.maxWidth = builder.maxWidth;
this.maxHeight = builder.maxHeight;
this.sizingPolicy = builder.sizingPolicy;
this.paddingPolicy = builder.paddingPolicy;
}
/**
*
* The format of thumbnails, if any. Valid values are jpg
and png
.
*
*
* You specify whether you want Elastic Transcoder to create thumbnails when you create a job.
*
*
* @return The format of thumbnails, if any. Valid values are jpg
and png
.
*
* You specify whether you want Elastic Transcoder to create thumbnails when you create a job.
*/
public final String format() {
return format;
}
/**
*
* The approximate number of seconds between thumbnails. Specify an integer value.
*
*
* @return The approximate number of seconds between thumbnails. Specify an integer value.
*/
public final String interval() {
return interval;
}
/**
*
*
* To better control resolution and aspect ratio of thumbnails, we recommend that you use the values
* MaxWidth
, MaxHeight
, SizingPolicy
, and PaddingPolicy
instead
* of Resolution
and AspectRatio
. The two groups of settings are mutually exclusive. Do
* not use them together.
*
*
*
* The width and height of thumbnail files in pixels. Specify a value in the format width
x
* height
where both values are even integers. The values cannot exceed the width and height
* that you specified in the Video:Resolution
object.
*
*
* @return
* To better control resolution and aspect ratio of thumbnails, we recommend that you use the values
* MaxWidth
, MaxHeight
, SizingPolicy
, and PaddingPolicy
* instead of Resolution
and AspectRatio
. The two groups of settings are mutually
* exclusive. Do not use them together.
*
*
*
* The width and height of thumbnail files in pixels. Specify a value in the format
* width
x height
where both values are even integers. The
* values cannot exceed the width and height that you specified in the Video:Resolution
object.
*/
public final String resolution() {
return resolution;
}
/**
*
*
* To better control resolution and aspect ratio of thumbnails, we recommend that you use the values
* MaxWidth
, MaxHeight
, SizingPolicy
, and PaddingPolicy
instead
* of Resolution
and AspectRatio
. The two groups of settings are mutually exclusive. Do
* not use them together.
*
*
*
* The aspect ratio of thumbnails. Valid values include:
*
*
* auto
, 1:1
, 4:3
, 3:2
, 16:9
*
*
* If you specify auto
, Elastic Transcoder tries to preserve the aspect ratio of the video in the
* output file.
*
*
* @return
* To better control resolution and aspect ratio of thumbnails, we recommend that you use the values
* MaxWidth
, MaxHeight
, SizingPolicy
, and PaddingPolicy
* instead of Resolution
and AspectRatio
. The two groups of settings are mutually
* exclusive. Do not use them together.
*
*
*
* The aspect ratio of thumbnails. Valid values include:
*
*
* auto
, 1:1
, 4:3
, 3:2
, 16:9
*
*
* If you specify auto
, Elastic Transcoder tries to preserve the aspect ratio of the video in
* the output file.
*/
public final String aspectRatio() {
return aspectRatio;
}
/**
*
* The maximum width of thumbnails in pixels. If you specify auto, Elastic Transcoder uses 1920 (Full HD) as the
* default value. If you specify a numeric value, enter an even integer between 32 and 4096.
*
*
* @return The maximum width of thumbnails in pixels. If you specify auto, Elastic Transcoder uses 1920 (Full HD) as
* the default value. If you specify a numeric value, enter an even integer between 32 and 4096.
*/
public final String maxWidth() {
return maxWidth;
}
/**
*
* The maximum height of thumbnails in pixels. If you specify auto, Elastic Transcoder uses 1080 (Full HD) as the
* default value. If you specify a numeric value, enter an even integer between 32 and 3072.
*
*
* @return The maximum height of thumbnails in pixels. If you specify auto, Elastic Transcoder uses 1080 (Full HD)
* as the default value. If you specify a numeric value, enter an even integer between 32 and 3072.
*/
public final String maxHeight() {
return maxHeight;
}
/**
*
* Specify one of the following values to control scaling of thumbnails:
*
*
* -
*
* Fit
: Elastic Transcoder scales thumbnails so they match the value that you specified in thumbnail
* MaxWidth or MaxHeight settings without exceeding the other value.
*
*
* -
*
* Fill
: Elastic Transcoder scales thumbnails so they match the value that you specified in thumbnail
* MaxWidth
or MaxHeight
settings and matches or exceeds the other value. Elastic
* Transcoder centers the image in thumbnails and then crops in the dimension (if any) that exceeds the maximum
* value.
*
*
* -
*
* Stretch
: Elastic Transcoder stretches thumbnails to match the values that you specified for
* thumbnail MaxWidth
and MaxHeight
settings. If the relative proportions of the input
* video and thumbnails are different, the thumbnails will be distorted.
*
*
* -
*
* Keep
: Elastic Transcoder does not scale thumbnails. If either dimension of the input video exceeds
* the values that you specified for thumbnail MaxWidth
and MaxHeight
settings, Elastic
* Transcoder crops the thumbnails.
*
*
* -
*
* ShrinkToFit
: Elastic Transcoder scales thumbnails down so that their dimensions match the values
* that you specified for at least one of thumbnail MaxWidth
and MaxHeight
without
* exceeding either value. If you specify this option, Elastic Transcoder does not scale thumbnails up.
*
*
* -
*
* ShrinkToFill
: Elastic Transcoder scales thumbnails down so that their dimensions match the values
* that you specified for at least one of MaxWidth
and MaxHeight
without dropping below
* either value. If you specify this option, Elastic Transcoder does not scale thumbnails up.
*
*
*
*
* @return Specify one of the following values to control scaling of thumbnails:
*
* -
*
* Fit
: Elastic Transcoder scales thumbnails so they match the value that you specified in
* thumbnail MaxWidth or MaxHeight settings without exceeding the other value.
*
*
* -
*
* Fill
: Elastic Transcoder scales thumbnails so they match the value that you specified in
* thumbnail MaxWidth
or MaxHeight
settings and matches or exceeds the other
* value. Elastic Transcoder centers the image in thumbnails and then crops in the dimension (if any) that
* exceeds the maximum value.
*
*
* -
*
* Stretch
: Elastic Transcoder stretches thumbnails to match the values that you specified for
* thumbnail MaxWidth
and MaxHeight
settings. If the relative proportions of the
* input video and thumbnails are different, the thumbnails will be distorted.
*
*
* -
*
* Keep
: Elastic Transcoder does not scale thumbnails. If either dimension of the input video
* exceeds the values that you specified for thumbnail MaxWidth
and MaxHeight
* settings, Elastic Transcoder crops the thumbnails.
*
*
* -
*
* ShrinkToFit
: Elastic Transcoder scales thumbnails down so that their dimensions match the
* values that you specified for at least one of thumbnail MaxWidth
and MaxHeight
* without exceeding either value. If you specify this option, Elastic Transcoder does not scale thumbnails
* up.
*
*
* -
*
* ShrinkToFill
: Elastic Transcoder scales thumbnails down so that their dimensions match the
* values that you specified for at least one of MaxWidth
and MaxHeight
without
* dropping below either value. If you specify this option, Elastic Transcoder does not scale thumbnails up.
*
*
*/
public final String sizingPolicy() {
return sizingPolicy;
}
/**
*
* When you set PaddingPolicy
to Pad
, Elastic Transcoder may add black bars to the top and
* bottom and/or left and right sides of thumbnails to make the total size of the thumbnails match the values that
* you specified for thumbnail MaxWidth
and MaxHeight
settings.
*
*
* @return When you set PaddingPolicy
to Pad
, Elastic Transcoder may add black bars to the
* top and bottom and/or left and right sides of thumbnails to make the total size of the thumbnails match
* the values that you specified for thumbnail MaxWidth
and MaxHeight
settings.
*/
public final String paddingPolicy() {
return paddingPolicy;
}
@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(format());
hashCode = 31 * hashCode + Objects.hashCode(interval());
hashCode = 31 * hashCode + Objects.hashCode(resolution());
hashCode = 31 * hashCode + Objects.hashCode(aspectRatio());
hashCode = 31 * hashCode + Objects.hashCode(maxWidth());
hashCode = 31 * hashCode + Objects.hashCode(maxHeight());
hashCode = 31 * hashCode + Objects.hashCode(sizingPolicy());
hashCode = 31 * hashCode + Objects.hashCode(paddingPolicy());
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 Thumbnails)) {
return false;
}
Thumbnails other = (Thumbnails) obj;
return Objects.equals(format(), other.format()) && Objects.equals(interval(), other.interval())
&& Objects.equals(resolution(), other.resolution()) && Objects.equals(aspectRatio(), other.aspectRatio())
&& Objects.equals(maxWidth(), other.maxWidth()) && Objects.equals(maxHeight(), other.maxHeight())
&& Objects.equals(sizingPolicy(), other.sizingPolicy()) && Objects.equals(paddingPolicy(), other.paddingPolicy());
}
/**
* 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("Thumbnails").add("Format", format()).add("Interval", interval()).add("Resolution", resolution())
.add("AspectRatio", aspectRatio()).add("MaxWidth", maxWidth()).add("MaxHeight", maxHeight())
.add("SizingPolicy", sizingPolicy()).add("PaddingPolicy", paddingPolicy()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Format":
return Optional.ofNullable(clazz.cast(format()));
case "Interval":
return Optional.ofNullable(clazz.cast(interval()));
case "Resolution":
return Optional.ofNullable(clazz.cast(resolution()));
case "AspectRatio":
return Optional.ofNullable(clazz.cast(aspectRatio()));
case "MaxWidth":
return Optional.ofNullable(clazz.cast(maxWidth()));
case "MaxHeight":
return Optional.ofNullable(clazz.cast(maxHeight()));
case "SizingPolicy":
return Optional.ofNullable(clazz.cast(sizingPolicy()));
case "PaddingPolicy":
return Optional.ofNullable(clazz.cast(paddingPolicy()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function