|
|
Re: XtendParser [message #540652 is a reply to message #540602] |
Wed, 16 June 2010 20:32 |
Macca1892 Messages: 14 Registered: May 2010 |
Junior Member |
|
|
Thank you very much, Erhard Weinell !
Yeah, the string expression actually is the content of .ext file.
I used to "hardcode" directly the content of .ext file but it is much nicer to use InputStreamReader as you suggested
But now I have another problem with java.lang.NullPointerException at this point:
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
I am quite sure that parse function works well because I can read some information from the instance of ExtensionFile. Thus I don't understand why NullPointerException is there
Here is the test code:
ec = new ExecutionContextImpl();
ec.registerMetaModel(new JavaMetaModel("JavaMetaModel", new JavaBeansStrategy()));
final ExtensionFile file = parse(
"foo(String str) : 'String';" +
"foo(Integer int) : 'Int';" +
"foo(Void void) : 'void';");
ec = (ExecutionContextImpl) ec.cloneWithResource(file);
XtendFacade facade = XtendFacade.create(ec);
assertEquals("String",facade.call("foo", "String"));
assertEquals("Int",facade.call("foo", new Long(42)));
assertEquals("void",facade.call("foo", (Object) null));
|
|
|
|
Powered by
FUDForum. Page generated in 0.03505 seconds