public interface SerializerAdapter
Modifier and Type | Method and Description |
---|---|
default <T> T |
deserialize(byte[] bytes,
Type type,
SerializerEncoding encoding)
Deserializes a byte array into an object.
|
<T> T |
deserialize(HttpHeaders headers,
Type type)
Deserialize the provided headers returned from a REST API to an entity instance declared as the model to hold
'Matching' headers.
|
default <T> T |
deserialize(InputStream inputStream,
Type type,
SerializerEncoding encoding)
Deserializes a stream into an object.
|
<T> T |
deserialize(String value,
Type type,
SerializerEncoding encoding)
Deserializes a string into an object.
|
String |
serialize(Object object,
SerializerEncoding encoding)
Serializes an object into a string.
|
default void |
serialize(Object object,
SerializerEncoding encoding,
OutputStream outputStream)
Serializes an object and writes its output into an
OutputStream . |
default String |
serializeIterable(Iterable<?> iterable,
CollectionFormat format)
Serializes an iterable into a string with the delimiter specified with the Swagger collection format joining each
individual serialized items in the list.
|
String |
serializeList(List<?> list,
CollectionFormat format)
Serializes a list into a string with the delimiter specified with the Swagger collection format joining each
individual serialized items in the list.
|
String |
serializeRaw(Object object)
Serializes an object into a raw string, leading and trailing quotes will be trimmed.
|
default byte[] |
serializeToBytes(Object object,
SerializerEncoding encoding)
Serializes an object into a byte array.
|
String serialize(Object object, SerializerEncoding encoding) throws IOException
object
- The object to serialize.encoding
- The serialization encoding.IOException
- If an IO exception was thrown during serialization.default byte[] serializeToBytes(Object object, SerializerEncoding encoding) throws IOException
object
- The object to serialize.encoding
- The serialization encoding.IOException
- If an IO exception was thrown during serialization.default void serialize(Object object, SerializerEncoding encoding, OutputStream outputStream) throws IOException
OutputStream
.object
- The object to serialize.encoding
- The serialization encoding.outputStream
- The OutputStream
where the serialized object will be written.IOException
- If an IO exception was thrown during serialization.String serializeRaw(Object object)
object
- The object to serialize.String serializeList(List<?> list, CollectionFormat format)
list
- The list to serialize.format
- The collection joining format.default String serializeIterable(Iterable<?> iterable, CollectionFormat format)
iterable
- The iterable to serialize.format
- The collection joining format.<T> T deserialize(String value, Type type, SerializerEncoding encoding) throws IOException
T
- The type of the deserialized object.value
- The string to deserialize.type
- The type of the deserialized object.encoding
- The deserialization encoding.IOException
- If an IO exception was thrown during deserialization.default <T> T deserialize(byte[] bytes, Type type, SerializerEncoding encoding) throws IOException
T
- The type of the deserialized object.bytes
- The byte array to deserialize.type
- The type of the deserialized object.encoding
- The deserialization encoding.IOException
- If an IO exception was thrown during serialization.default <T> T deserialize(InputStream inputStream, Type type, SerializerEncoding encoding) throws IOException
T
- The type of the deserialized object.inputStream
- The InputStream
to deserialize.type
- The type of the deserialized object.encoding
- The deserialization encoding.IOException
- If an IO exception was thrown during serialization.<T> T deserialize(HttpHeaders headers, Type type) throws IOException
'Matching' headers are the REST API returned headers those with:
HeaderCollection
annotation applied to
the properties in the entity.ResponseBase
returned by java proxy method corresponding to the REST API.
e.g.
Mono<RestResponseBase<FooMetadataHeaders, Void>> getMetadata(args);
class FooMetadataHeaders {
String name;
{@literal @}HeaderCollection("header-collection-prefix-")
Map<String,String> headerCollection;
}
in the case of above example, this method produces an instance of FooMetadataHeaders from provided
headers
.T
- the type of the deserialized objectheaders
- the REST API returned headerstype
- the type to deserializeheaders
, if header entity model does not
not exists then return nullIOException
- If an I/O error occursCopyright © 2021 Microsoft Corporation. All rights reserved.