
software.amazon.awssdk.services.elastictranscoder.model.DetectedProperties Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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;
/**
*
* The detected properties of the input file. Elastic Transcoder identifies these values from the input file.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DetectedProperties implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField WIDTH_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(DetectedProperties::width)).setter(setter(Builder::width))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Width").build()).build();
private static final SdkField HEIGHT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.getter(getter(DetectedProperties::height)).setter(setter(Builder::height))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Height").build()).build();
private static final SdkField FRAME_RATE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DetectedProperties::frameRate)).setter(setter(Builder::frameRate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FrameRate").build()).build();
private static final SdkField FILE_SIZE_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(DetectedProperties::fileSize)).setter(setter(Builder::fileSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FileSize").build()).build();
private static final SdkField DURATION_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(DetectedProperties::durationMillis)).setter(setter(Builder::durationMillis))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DurationMillis").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(WIDTH_FIELD, HEIGHT_FIELD,
FRAME_RATE_FIELD, FILE_SIZE_FIELD, DURATION_MILLIS_FIELD));
private static final long serialVersionUID = 1L;
private final Integer width;
private final Integer height;
private final String frameRate;
private final Long fileSize;
private final Long durationMillis;
private DetectedProperties(BuilderImpl builder) {
this.width = builder.width;
this.height = builder.height;
this.frameRate = builder.frameRate;
this.fileSize = builder.fileSize;
this.durationMillis = builder.durationMillis;
}
/**
*
* The detected width of the input file, in pixels.
*
*
* @return The detected width of the input file, in pixels.
*/
public Integer width() {
return width;
}
/**
*
* The detected height of the input file, in pixels.
*
*
* @return The detected height of the input file, in pixels.
*/
public Integer height() {
return height;
}
/**
*
* The detected frame rate of the input file, in frames per second.
*
*
* @return The detected frame rate of the input file, in frames per second.
*/
public String frameRate() {
return frameRate;
}
/**
*
* The detected file size of the input file, in bytes.
*
*
* @return The detected file size of the input file, in bytes.
*/
public Long fileSize() {
return fileSize;
}
/**
*
* The detected duration of the input file, in milliseconds.
*
*
* @return The detected duration of the input file, in milliseconds.
*/
public Long durationMillis() {
return durationMillis;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(width());
hashCode = 31 * hashCode + Objects.hashCode(height());
hashCode = 31 * hashCode + Objects.hashCode(frameRate());
hashCode = 31 * hashCode + Objects.hashCode(fileSize());
hashCode = 31 * hashCode + Objects.hashCode(durationMillis());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DetectedProperties)) {
return false;
}
DetectedProperties other = (DetectedProperties) obj;
return Objects.equals(width(), other.width()) && Objects.equals(height(), other.height())
&& Objects.equals(frameRate(), other.frameRate()) && Objects.equals(fileSize(), other.fileSize())
&& Objects.equals(durationMillis(), other.durationMillis());
}
/**
* 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 String toString() {
return ToString.builder("DetectedProperties").add("Width", width()).add("Height", height()).add("FrameRate", frameRate())
.add("FileSize", fileSize()).add("DurationMillis", durationMillis()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Width":
return Optional.ofNullable(clazz.cast(width()));
case "Height":
return Optional.ofNullable(clazz.cast(height()));
case "FrameRate":
return Optional.ofNullable(clazz.cast(frameRate()));
case "FileSize":
return Optional.ofNullable(clazz.cast(fileSize()));
case "DurationMillis":
return Optional.ofNullable(clazz.cast(durationMillis()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
© 2015 - 2025 Weber Informatics LLC | Privacy Policy