我尝试在 scala 中使用 XStream,但看起来 XSteam 中的注释在 scala 中不起作用。在下面的代码中,只有@XStreamAlias 有效,我还附上了一个示例输出,有人可以帮忙吗?
@XStreamAlias("posts")
case class Posts(
@XStreamAsAttribute tag: String,
@XStreamAsAttribute total: String,
@XStreamAsAttribute user: String,
@XStreamImplicit(itemFieldName="post") posts: JList[Post])
@XStreamAlias("post")
case class Post(
@XStreamAsAttribute description: String,
@XStreamAsAttribute extended: String,
@XStreamAsAttribute hash: String,
@XStreamAsAttribute href: String,
@XStreamAsAttribute shared: String,
@XStreamAsAttribute tag: String,
@XStreamAsAttribute time: String)
<posts>
<tag>a</tag>
<total>b</total>
<user>c</user>
<posts>
<post>
<description></description>
<extended></extended>
<hash></hash>
<href></href>
<shared></shared>
<tag></tag>
<time></time>
</post>
</posts>
</posts>