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)
Deprecated.
Use
TypedValue(Object, DataType, OptionalLong) instead. |
TypedValue(T value,
DataType dataType,
OptionalLong length)
Constructs a new
TypedValue with the given parameters. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
OptionalLong |
getByteLength()
If available obtain the length (in bytes) of the valye.
|
DataType |
getDataType()
Returns the data type (if any) associated with this
TypedValue's content. |
Optional<Long> |
getLength()
Deprecated.
Use
getByteLength() instead. |
T |
getValue() |
int |
hashCode() |
static <T> TypedValue<T> |
of(T value)
Creates a new instance for the given
value, using an auto calculated DataType. |
String |
toString() |
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
value 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.@Deprecated public TypedValue(T value, DataType dataType, Optional<Long> length)
TypedValue(Object, DataType, OptionalLong) instead.TypedValue with the given parameters.value - this object's content.dataType - the DataType for this object's content.length - the length of the value in bytes.public TypedValue(T value, DataType dataType, OptionalLong length)
TypedValue with the given parameters.value - this object's content.dataType - the DataType for this object's content.length - the length of the value in bytes.public static <T> T unwrap(Object value)
value is a type value at
all.
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()
@Deprecated public Optional<Long> getLength()
getByteLength() instead.public OptionalLong getByteLength()
Copyright © 2021 MuleSoft, Inc.. All rights reserved.