software.amazon.awssdk.services.elastictranscoder.model.Clip Maven / Gradle / Ivy
/*
* Copyright 2013-2018 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.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.core.protocol.ProtocolMarshaller;
import software.amazon.awssdk.core.protocol.StructuredPojo;
import software.amazon.awssdk.services.elastictranscoder.transform.ClipMarshaller;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Settings for one clip in a composition. All jobs in a playlist must have the same clip settings.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Clip implements StructuredPojo, ToCopyableBuilder {
private final TimeSpan timeSpan;
private Clip(BuilderImpl builder) {
this.timeSpan = builder.timeSpan;
}
/**
*
* Settings that determine when a clip begins and how long it lasts.
*
*
* @return Settings that determine when a clip begins and how long it lasts.
*/
public TimeSpan timeSpan() {
return timeSpan;
}
@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(timeSpan());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Clip)) {
return false;
}
Clip other = (Clip) obj;
return Objects.equals(timeSpan(), other.timeSpan());
}
@Override
public String toString() {
return ToString.builder("Clip").add("TimeSpan", timeSpan()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TimeSpan":
return Optional.ofNullable(clazz.cast(timeSpan()));
default:
return Optional.empty();
}
}
@SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
ClipMarshaller.getInstance().marshall(this, protocolMarshaller);
}
public interface Builder extends CopyableBuilder {
/**
*
* Settings that determine when a clip begins and how long it lasts.
*
*
* @param timeSpan
* Settings that determine when a clip begins and how long it lasts.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder timeSpan(TimeSpan timeSpan);
/**
*
* Settings that determine when a clip begins and how long it lasts.
*
* This is a convenience that creates an instance of the {@link TimeSpan.Builder} avoiding the need to create
* one manually via {@link TimeSpan#builder()}.
*
* When the {@link Consumer} completes, {@link TimeSpan.Builder#build()} is called immediately and its result is
* passed to {@link #timeSpan(TimeSpan)}.
*
* @param timeSpan
* a consumer that will call methods on {@link TimeSpan.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #timeSpan(TimeSpan)
*/
default Builder timeSpan(Consumer timeSpan) {
return timeSpan(TimeSpan.builder().applyMutation(timeSpan).build());
}
}
static final class BuilderImpl implements Builder {
private TimeSpan timeSpan;
private BuilderImpl() {
}
private BuilderImpl(Clip model) {
timeSpan(model.timeSpan);
}
public final TimeSpan.Builder getTimeSpan() {
return timeSpan != null ? timeSpan.toBuilder() : null;
}
@Override
public final Builder timeSpan(TimeSpan timeSpan) {
this.timeSpan = timeSpan;
return this;
}
public final void setTimeSpan(TimeSpan.BuilderImpl timeSpan) {
this.timeSpan = timeSpan != null ? timeSpan.build() : null;
}
@Override
public Clip build() {
return new Clip(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy