use of io.servicecomb.codec.protobuf.jackson.StandardObjectWriter in project java-chassis by ServiceComb.
the class StandardParamCodec method init.
@Override
public void init(ProtobufSchema schema, Type... types) {
writer = ProtobufManager.getMapper().writer(schema);
reader = ProtobufManager.getMapper().reader(schema);
// 需要考虑没参数的场景
if (types.length == 1) {
JavaType javaType = TypeFactory.defaultInstance().constructType(types[0]);
writer = new StandardObjectWriter(writer.forType(javaType));
reader = new StandardObjectReader(reader.forType(javaType));
}
}
Aggregations