T - the content type.public final class TypedValue<T> extends Object implements Serializable
DataType.| Constructor and Description |
|---|
TypedValue(T value,
DataType dataType)
Constructs a new
TypedValue with the given parameters. |
TypedValue(T value,
DataType dataType,
Optional<Long> length)
Constructs a new
TypedValue with the given parameters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
DataType |
getDataType()
Returns the data type (if any) associated with this
TypedValue's content. |
Optional<Long> |
getLength()
If available obtain the length (in bytes) of the valye.
|
T |
getValue() |
int |
hashCode() |
static <T> TypedValue<T> |
of(T value)
Creates a new instance for the given
value, using an auto calculated DataType. |
static <T> T |
unwrap(Object value)
Utility method to obtain a type value's content, in cases in which you don't know if the is a type value at
all.
|
public TypedValue(T value, DataType dataType)
TypedValue with the given parameters.value - this object's content.dataType - the DataType for this object's content.public static <T> T unwrap(Object value)
If value is a TypeValue, then getValue() is returned. Otherwise, the value is returned as is (even
if it's null)
T - the output's generic typevalue - a value which may or may not be a TypeValuepublic static <T> TypedValue<T> of(T value)
value, using an auto calculated DataType. This method is useful when no
particular media types or encoding are requiredT - the value's generic typevalue - this object's contentTypedValuepublic DataType getDataType()
TypedValue's content.DataType for this object's content.public T getValue()
public Optional<Long> getLength()
Copyright © 2017 MuleSoft, Inc.. All rights reserved.