Let java class inherits TBase serialize

Need to be automatically generated by thrift-0.8.0.exe tool!

Execution thrift software can see a lot of dos command parameters.

Java serialization class, there needs to --gen java.

That is, in thrift software directory, execute thrift-0.8.0.exe --gen java Tree.thrift command. Tree.thrift where we need to be serialized format class,

namespace java com.baidu.game

struct Tree {
1: required i64 loveSpaceId;
2: required i64 time;
3: required string name = "";
4: optional i32 level = 0;
5: optional i32 growth = 0;
6: optional i32 status = 0;
7: optional i32 gold;
}

Where the optional parameter is optional, required for the necessary parameters!

After executing the command post, you can see the gen-java folder in the current folder, which is to follow behind us above the inverted domain namespace directory.
Which is automatically generated classes -

When you see this line of text, I have not had time to sort out this part of knowledge, notes the wording in some places are not allowed, the reader is referred, as appropriate, do not be misled - I

Reproduced in: https: //www.cnblogs.com/xu-thinking/p/3559926.html

Guess you like

Origin blog.csdn.net/weixin_34258782/article/details/93374823