Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Java service wrapper problem/reflection
[Acceleo] Java service wrapper problem/reflection [message #1795495] Mon, 24 September 2018 10:08 Go to next message
john foobar is currently offline john foobarFriend
Messages: 1
Registered: July 2018
Junior Member
I'm having trouble with the returned list of a java service.
When i try to use the list i get always this message error:
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid result for expression self.invoke('', 'getAList(java.lang.String)', Sequence {arg0}) at line 13 in Module service for query getAList(String).

This is the java file.
public List <String> getAList(String s){
        Class clazz = Class.forName(s);
        Method[] publicMethods= clazz.getDeclaredMethods();
        List<String> list=new ArrayList<>();
        List<String> list2=new ArrayList<>();
        for (Method met : publicMethods){
                Class[] parameter= met.getParameterTypes();
                for(Class parameter1: parameter){
		list.add(met.getName() +"(" + list2 + ")");
        return list;

Then the query in the mtl file.
[query public getAList(arg0 : String) : Sequence(OclAny)
	= invoke('', 'getAList(java.lang.String)', Sequence{arg0})

And this is where i try to use the java service.
[let a: Sequence (String) = getAList(var) ]

Anyone can help me understand what is wrong? Does acceleo have a problem with java reflection?

[Updated on: Tue, 02 October 2018 11:44]

Report message to a moderator

Re: [Acceleo] Java service wrapper problem/reflection [message #1798831 is a reply to message #1795495] Mon, 26 November 2018 12:59 Go to previous message
Shimon Zadok is currently offline Shimon ZadokFriend
Messages: 24
Registered: May 2016
Junior Member
Have you tried maybe to use 'Sequence(String)' as the return type of the query?

[Updated on: Mon, 26 November 2018 13:00]

Report message to a moderator

Previous Topic:[acceleo] Find the root element
Next Topic:Strange behaviour on generating text - Indentations do not match
Goto Forum:

Current Time: Sat Jul 13 16:21:48 GMT 2024

Powered by FUDForum. Page generated in 0.03670 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top