简体   繁体   English

Protostuff 1.3.8中的RuntimeSchema

[英]RuntimeSchema in Protostuff 1.3.8

I am trying to learn how to use Protostuff. 我正在尝试学习如何使用Protostuff。 I have an example that uses protostuff 1.0.7. 我有一个使用protostuff 1.0.7的示例。 In this example the class RuntimeSchema is used. 在此示例中,使用类RuntimeSchema。

When I try to reproduce the code with a current version of protostuff (1.3.8), I fail, because the class RuntimeSchema does not seem to exist. 当我尝试使用最新版本的protostuff(1.3.8)重现代码时,我失败了,因为类RuntimeSchema似乎不存在。 I searched the net for a current tutorial but all I could find was: https://github.com/protostuff/protostuff/wiki/Examples which, honestly, I don't understand. 我在网上搜索了当前的教程,但是我只能找到: https : //github.com/protostuff/protostuff/wiki/Examples ,说实话,我不理解。

Can someone help me understand how protostuff is supposed to be used in the current version? 有人可以帮助我了解当前版本中应如何使用原型吗?

I checked up on my own code to have a look for you, and here is what I am doing: 我检查了自己的代码来寻找您,这是我正在做的事情:

LinkedBuffer buffer = LinkedBuffer.allocate(2048);
Schema<Order> orderSchema = RuntimeSchema.getSchema(Order.class);

ProtostuffIOUtil.toByteArray(order2, orderSchema, buffer);
buffer.clear();

So the same really as the examples. 因此,实际上与示例相同。 The only thing I can suggest doing is that your POM includes all three dependencies: 我唯一建议做的是,您的POM包括所有三个依赖项:

  • Protostuff Runtime (the one you are probably missing) Protostuff运行时(您可能缺少的那个)
  • Protostuff API 原型API
  • Protostuff Core 原型核心

In the future the best thing to look at for a problem like this is always that you have all necessary dependencies. 将来,最好的办法就是始终拥有所有必要的依赖关系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM