0

需要帮助将以下代码转换为 jcodemodel 可理解的格式

@Override
    public final void blah() {
XStream xstream = new XStream(new DomDriver());
        String xml = xstream.toXML(this);
}

任何帮助表示赞赏。

4

1 回答 1

0

没关系...解决了它... :)

JBlock block = jtoStringMethod.body();
        JVar line1 = block.decl(xstream, "xstream", JExpr._new(xstream).arg(JExpr._new(domDriver)));
        JVar line2 = block.decl(jmod._ref(String.class), "xml", JExpr.ref("xstream").invoke("toXML").arg(JExpr._this()));
        block._return(JExpr.ref("xml"));
于 2015-12-16T06:44:39.713 回答