- Type Parameters:
T- type of entity
public interface EntityWriter<T>
Writer of entity into bytes.
-
Method Summary
Modifier and TypeMethodDescriptiondefault InstanceWriterinstanceWriter(GenericType<T> type, T object, Headers requestHeaders, WritableHeaders<?> responseHeaders) Server response entity instance writer.default InstanceWriterinstanceWriter(GenericType<T> type, T object, WritableHeaders<?> requestHeaders) Client request entity instance writer.default booleanWhether this entity writer can provide more information about each entity instance, such as content length.voidwrite(GenericType<T> type, T object, OutputStream outputStream, Headers requestHeaders, WritableHeaders<?> responseHeaders) Write server response entity and close the stream.voidwrite(GenericType<T> type, T object, OutputStream outputStream, WritableHeaders<?> headers) Write client request entity and close the stream.
-
Method Details
-
supportsInstanceWriter
default boolean supportsInstanceWriter()Whether this entity writer can provide more information about each entity instance, such as content length.- Returns:
- whether
instanceWritermethods are supported; If not one of thewritemethods would be called instead
-
instanceWriter
default InstanceWriter instanceWriter(GenericType<T> type, T object, WritableHeaders<?> requestHeaders) Client request entity instance writer.- Parameters:
type- type of entityobject- object to writerequestHeaders- request headers- Returns:
- instance writer ready to write the provided entity
-
instanceWriter
default InstanceWriter instanceWriter(GenericType<T> type, T object, Headers requestHeaders, WritableHeaders<?> responseHeaders) Server response entity instance writer.- Parameters:
type- type of entityobject- object to writerequestHeaders- request headersresponseHeaders- response headers- Returns:
- instance writer ready to write the provided entity
-
write
void write(GenericType<T> type, T object, OutputStream outputStream, Headers requestHeaders, WritableHeaders<?> responseHeaders) Write server response entity and close the stream.- Parameters:
type- type of entityobject- object to writeoutputStream- output stream to write torequestHeaders- request headersresponseHeaders- response headers
-
write
Write client request entity and close the stream.- Parameters:
type- type of entityobject- object to writeoutputStream- output stream to write toheaders- request headers
-