GH-660 Add initial suppport for sending/receiving Messages

Resolves #660
This commit is contained in:
Oleg Zhurakousky
2021-02-28 15:50:11 +01:00
parent ebc7bbd692
commit 694d831adf
12 changed files with 654 additions and 48 deletions

View File

@@ -314,10 +314,11 @@ public final class FunctionTypeUtils {
if (isPublisher(type)) {
type = getImmediateGenericType(type, 0);
}
if (type instanceof ParameterizedType && TypeResolver.resolveRawClass(type, null) != Message.class) {
if (type instanceof ParameterizedType && !Message.class.isAssignableFrom(TypeResolver.resolveRawClass(type, null))) {
type = getImmediateGenericType(type, 0);
}
return TypeResolver.resolveRawClass(type, null) == Message.class;
return Message.class.isAssignableFrom(TypeResolver.resolveRawClass(type, null));
}
/**

View File

@@ -87,7 +87,15 @@ public abstract class JsonMapper {
return (T) json;
}
}
return this.doFromJson(json, type);
if (json instanceof String && !isJsonString(json) && (String.class == type || byte[].class == type)) {
return String.class == type ? (T) json : (T) ((String) json).getBytes(StandardCharsets.UTF_8);
}
// if (String.class == type && json instanceof String && !isJsonString(json)) {
// return (T) json;
// }
else {
return this.doFromJson(json, type);
}
}
}