Typing the header's value

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-09-16 21:29:58 -03:00
parent 3f87394cbb
commit 4eb6cfaa95
1 changed files with 7 additions and 5 deletions

View File

@ -176,12 +176,13 @@ public final class Json {
/**
* Creates a JSON Data Marshaller that produces a {@link String}
* @param <T> The 'data' type
* @param <H> The type of headers value
* @return A new instance of {@link DataMarshaller}
*/
public static <T> DataMarshaller<String, T> marshaller() {
return new DataMarshaller<String, T>() {
public static <T, H> DataMarshaller<String, T, H> marshaller() {
return new DataMarshaller<String, T, H>() {
@Override
public String marshal(T data, Map<String, Object> headers) {
public String marshal(T data, Map<String, H> headers) {
return Json.encode(data);
}
};
@ -190,12 +191,13 @@ public final class Json {
/**
* Marshalls the 'data' value as JSON, producing a byte array
* @param <T> The 'data' type
* @param <H> The type of headers value
* @param data The 'data' value
* @param headers The headers
* @return A byte array with 'data' value encoded JSON
*/
public static <T> byte[] binaryMarshal(T data,
Map<String, Object> headers) {
public static <T, H> byte[] binaryMarshal(T data,
Map<String, H> headers) {
return Json.binaryEncode(data);
}