[Acceleo] pb with java services [message #1754102] |
Tue, 14 February 2017 14:33 |
Julien Pourille Messages: 8 Registered: February 2017 |
Junior Member |
|
|
Hy everybody,
I have a big problem and nobody that I know could resolve it.
I juste want to create a Java services class which is called by Acceleo template.
javaservices.mtl
[comment encoding = UTF-8 /]
[module javaservices('http://www.example.org/stanHelp')/]
[query public getDescription(aFunction: Function) : String
= invoke('org.eclipse.acceleo.module.sample.services.JavaServices', 'getDescription(java.lang.String)', Sequence{aFunction.id})
/]
JavaServices.java
package org.eclipse.acceleo.module.sample.services;
import stanHelp.Function;
public class JavaServices {
public String getDescription(String aFunctionId) {
return "Description of : " + aFunctionId;
}
}
generate.mtl
[comment encoding = UTF-8 /]
[module generate('http://www.example.org/stanHelp')]
[import org::eclipse::acceleo::module::sample::services::javaservices /]
[template public generateElement(aMainContainer : MainContainer)]
[comment @main/]
[let aFunction : Function = aMainContainer.functions->first()]
[file ('test.html', false, 'UTF-8')]
[getDescription(aFunction)/]
[/file]
[/let]
[/template]
When I execute this code, i have the following warning :
Invalid result for expression self.invoke('org.eclipse.acceleo.module.sample.services.JavaServices', 'getDescription(stanHelp.Function)', Sequence {arg0}) at line 4 in Module javaservices for query getDescription(Function). Last recorded value of self was org.eclipse.emf.ecore.impl.DynamicEObjectImpl@3cd517a7 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@7bb6c78c (name: MainContainer) (instanceClassName: null) (abstract: false, interface: false)). Problem found while generating the file '/home/ssp/T0164153/workspace_acceleo/org.eclipse.acceleo.module.sample/generatedHtml/test.html'.
And the following error :
One of the parameters' class couldn't be loaded for method getDescription(stanHelp.Function) of class org.eclipse.acceleo.module.sample.services.JavaServices.
Can anyone help me to solve this strange problem?
Thanks
|
|
|
|
Powered by
FUDForum. Page generated in 0.03308 seconds