/* * Copyright 2010-2022 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 com.amazonaws.services.kinesisvideoarchivedmedia.model; import java.io.Serializable; /** *
* Describes the timestamp range and timestamp origin of a range of fragments. *
** Only fragments with a start timestamp greater than or equal to the given * start time and less than or equal to the end time are returned. For example, * if a stream contains fragments with the following start timestamps: *
** 00:00:00 *
** 00:00:02 *
** 00:00:04 *
** 00:00:06 *
** A fragment selector range with a start time of 00:00:01 and end time of * 00:00:04 would return the fragments with start times of 00:00:02 and * 00:00:04. *
*/ public class FragmentSelector implements Serializable { /** ** The origin of the timestamps to use (Server or Producer). *
*
* Constraints:
* Allowed Values: PRODUCER_TIMESTAMP, SERVER_TIMESTAMP
*/
private String fragmentSelectorType;
/**
*
* The range of timestamps to return. *
*/ private TimestampRange timestampRange; /** ** The origin of the timestamps to use (Server or Producer). *
*
* Constraints:
* Allowed Values: PRODUCER_TIMESTAMP, SERVER_TIMESTAMP
*
* @return
* The origin of the timestamps to use (Server or Producer). *
* @see FragmentSelectorType */ public String getFragmentSelectorType() { return fragmentSelectorType; } /** ** The origin of the timestamps to use (Server or Producer). *
*
* Constraints:
* Allowed Values: PRODUCER_TIMESTAMP, SERVER_TIMESTAMP
*
* @param fragmentSelectorType
* The origin of the timestamps to use (Server or Producer). *
* @see FragmentSelectorType */ public void setFragmentSelectorType(String fragmentSelectorType) { this.fragmentSelectorType = fragmentSelectorType; } /** ** The origin of the timestamps to use (Server or Producer). *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: PRODUCER_TIMESTAMP, SERVER_TIMESTAMP
*
* @param fragmentSelectorType
* The origin of the timestamps to use (Server or Producer). *
* @return A reference to this updated object so that method calls can be * chained together. * @see FragmentSelectorType */ public FragmentSelector withFragmentSelectorType(String fragmentSelectorType) { this.fragmentSelectorType = fragmentSelectorType; return this; } /** ** The origin of the timestamps to use (Server or Producer). *
*
* Constraints:
* Allowed Values: PRODUCER_TIMESTAMP, SERVER_TIMESTAMP
*
* @param fragmentSelectorType
* The origin of the timestamps to use (Server or Producer). *
* @see FragmentSelectorType */ public void setFragmentSelectorType(FragmentSelectorType fragmentSelectorType) { this.fragmentSelectorType = fragmentSelectorType.toString(); } /** ** The origin of the timestamps to use (Server or Producer). *
** Returns a reference to this object so that method calls can be chained * together. *
* Constraints:
* Allowed Values: PRODUCER_TIMESTAMP, SERVER_TIMESTAMP
*
* @param fragmentSelectorType
* The origin of the timestamps to use (Server or Producer). *
* @return A reference to this updated object so that method calls can be * chained together. * @see FragmentSelectorType */ public FragmentSelector withFragmentSelectorType(FragmentSelectorType fragmentSelectorType) { this.fragmentSelectorType = fragmentSelectorType.toString(); return this; } /** ** The range of timestamps to return. *
* * @return* The range of timestamps to return. *
*/ public TimestampRange getTimestampRange() { return timestampRange; } /** ** The range of timestamps to return. *
* * @param timestampRange* The range of timestamps to return. *
*/ public void setTimestampRange(TimestampRange timestampRange) { this.timestampRange = timestampRange; } /** ** The range of timestamps to return. *
** Returns a reference to this object so that method calls can be chained * together. * * @param timestampRange
* The range of timestamps to return. *
* @return A reference to this updated object so that method calls can be * chained together. */ public FragmentSelector withTimestampRange(TimestampRange timestampRange) { this.timestampRange = timestampRange; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getFragmentSelectorType() != null) sb.append("FragmentSelectorType: " + getFragmentSelectorType() + ","); if (getTimestampRange() != null) sb.append("TimestampRange: " + getTimestampRange()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getFragmentSelectorType() == null) ? 0 : getFragmentSelectorType().hashCode()); hashCode = prime * hashCode + ((getTimestampRange() == null) ? 0 : getTimestampRange().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof FragmentSelector == false) return false; FragmentSelector other = (FragmentSelector) obj; if (other.getFragmentSelectorType() == null ^ this.getFragmentSelectorType() == null) return false; if (other.getFragmentSelectorType() != null && other.getFragmentSelectorType().equals(this.getFragmentSelectorType()) == false) return false; if (other.getTimestampRange() == null ^ this.getTimestampRange() == null) return false; if (other.getTimestampRange() != null && other.getTimestampRange().equals(this.getTimestampRange()) == false) return false; return true; } }