public class UnknownSerializedType extends Object
Constructor and Description |
---|
UnknownSerializedType(Serializer serializer,
SerializedObject<?> serializedObject)
Initialize the unknown type, using given
serializer and serializedObject . |
Modifier and Type | Method and Description |
---|---|
<T> T |
readData(Class<T> desiredFormat)
Returns the data contained in the serialized object in the given
desiredFormat , if supported. |
SerializedType |
serializedType()
Returns the type of the serialized object, for which no class could be resolved.
|
<T> boolean |
supportsFormat(Class<T> desiredFormat)
Indicates whether the given
desiredFormat is supported as a representation for this type. |
public UnknownSerializedType(Serializer serializer, SerializedObject<?> serializedObject)
serializer
and serializedObject
.serializer
- the serializer attempting to deserialize the objectserializedObject
- the object being deserializedpublic <T> boolean supportsFormat(Class<T> desiredFormat)
desiredFormat
is supported as a representation for this type. More
specifically, it will consult the serializer that returned this instance whether it has a converter to convert
the serialized object's data to the desired typeT
- the format in which the serialized object is desireddesiredFormat
- the format in which the serialized object is desiredtrue
if the format is supported, otherwise false
public <T> T readData(Class<T> desiredFormat)
desiredFormat
, if supported. If the
desired format is unsupported, an exception is thrown, depending on the serializer.
To verify whether a format is supported, use supportsFormat(Class)
.
T
- the format in which the data is desireddesiredFormat
- the format in which the data is desiredpublic SerializedType serializedType()
Copyright © 2010–2019. All rights reserved.