Below is an example:
Method method = new Method(builderCall, genContext); method.setName("myMethod"); IXml args = null; try { args = XmlUtil.parseXml("<top><Argument><Name>msgValue</Name><Type>String</Type></Argument></top>"); } catch (IOException e) { e.printStackTrace(); } method.setArguments(args); StringBuffer sb = new StringBuffer("{ \n"); sb.append(" webAppAccess.getVariables().getVariable(\"myVar\").setValue(msgValue); \n"); sb.append("}"); method.setBody(sb.toString()); method.invokeBuilder();
and here's the code added to the model on regen:
/** * Generated Method [myMethod] */ public void myMethod(WebAppAccess webAppAccess, String msgValue) { webAppAccess.getVariables().getVariable("myVar").setValue(msgValue); }I figured out the magic XML for method.setArguments() by looking at the model XML for a standard method builder.
0 comments:
Post a Comment
Are you about to post a generic comment that has nothing to do with this post? Something like "Hey thanks for this very valuable information, BTW here's my website". If so, it will be marked as spam and deleted within 24 hours.
Note: Only a member of this blog may post a comment.