use of io.protostuff.compiler.model.Message in project incubator-servicecomb-java-chassis by apache.
the class OperationProtobuf method initResponseCodec.
private void initResponseCodec(ScopedProtobufSchemaManager scopedProtobufSchemaManager, Invocation invocation) {
ProtoMapper mapper = scopedProtobufSchemaManager.getOrCreateProtoMapper(invocation.getSchemaMeta());
Message responseMessage = mapper.getResponseMessage(invocation.getOperationMeta().getOperationId());
JavaType responseType = invocation.findResponseType(Status.OK.getStatusCode());
if (!invocation.isConsumer()) {
initProviderResponseCode(responseMessage, mapper, responseType);
} else {
initConsumerResponseCode(responseMessage, mapper, responseType);
}
anyResponseRootSerializer = new ResponseRootSerializer(mapper.createRootSerializer(ProtoConst.ANY, Object.class), false, true);
anyResponseRootDeserializer = new ResponseRootDeserializer<>(mapper.createRootDeserializer(ProtoConst.ANY, Object.class), false);
}
use of io.protostuff.compiler.model.Message in project incubator-servicecomb-java-chassis by apache.
the class AnyEntrySchema method createRootDeserializerFromCanonicaName.
protected RootDeserializer<Object> createRootDeserializerFromCanonicaName(String msgCanonicalName) {
Message message = protoMapper.getMessageFromCanonicaName(msgCanonicalName);
if (message == null) {
throw new IllegalStateException("can not find proto message to create deserializer, name=" + msgCanonicalName);
}
JavaType javaType = protoMapper.getAnyTypes().getOrDefault(msgCanonicalName, constructRuntimeType(ProtoConst.MAP_TYPE));
return protoMapper.createRootDeserializer(message, javaType);
}
Aggregations