public final class AMAttribute<T,V>
extends java.lang.Object
AdaptiveMedia
instance (e.g., its
width, size, etc.). Instances are annotated by a processor type and by the
attribute value type. The processor type restriction prevents AdaptiveMedia
users from requesting unsupported attributes (i.e., the set of
available attributes is checked at compile time). The attribute value type
annotation reduces (or avoids completely) the need to cast retrieved
attribute values.Constructor and Description |
---|
AMAttribute(java.lang.String name,
java.util.function.Function<java.lang.String,V> converterFunction,
AMDistanceComparator<V> amDistanceComparator)
Creates a new attribute.
|
Modifier and Type | Method and Description |
---|---|
long |
compare(V value1,
V value2)
Compares the two arguments for order.
|
V |
convert(java.lang.String value)
Returns the value converted to the correct type.
|
long |
distance(V value1,
V value2)
Returns the distance between the two values.
|
static java.util.Map<java.lang.String,AMAttribute<?,?>> |
getAllowedAMAttributes()
Returns a string-attribute map containing the available name-attribute
pairs.
|
static <S> AMAttribute<S,java.lang.String> |
getConfigurationUuidAMAttribute()
Returns a generic attribute representing the configuration UUID used to
generate the media.
|
static <S> AMAttribute<S,java.lang.Long> |
getContentLengthAMAttribute()
Returns a generic attribute representing the length of the media's
content.
|
static <S> AMAttribute<S,java.lang.String> |
getContentTypeAMAttribute()
Returns a generic attribute representing the media's content type.
|
static <S> AMAttribute<S,java.lang.String> |
getFileNameAMAttribute()
Returns a generic attribute representing the media's file name (if any).
|
java.lang.String |
getName()
Returns this
AdaptiveMedia instance's globally unique name. |
public AMAttribute(java.lang.String name, java.util.function.Function<java.lang.String,V> converterFunction, AMDistanceComparator<V> amDistanceComparator)
name
- a value that uniquely identifies the attributeamDistanceComparator
- the comparator to order the two arguments
based on the distance between their values; it should return a
value between Long.MIN_VALUE
and Long.MAX_VALUE
public static java.util.Map<java.lang.String,AMAttribute<?,?>> getAllowedAMAttributes()
public static <S> AMAttribute<S,java.lang.String> getConfigurationUuidAMAttribute()
public static <S> AMAttribute<S,java.lang.Long> getContentLengthAMAttribute()
public static <S> AMAttribute<S,java.lang.String> getContentTypeAMAttribute()
public static <S> AMAttribute<S,java.lang.String> getFileNameAMAttribute()
public long compare(V value1, V value2)
value1
- the first value to comparevalue2
- the second value to comparepublic V convert(java.lang.String value)
value
- the value to convertpublic long distance(V value1, V value2)
value1
- the first valuevalue2
- the second valueLong.MAX_VALUE
, representing the
distance between the two valuespublic java.lang.String getName()
AdaptiveMedia
instance's globally unique name.