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
Hi
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('org.eclipse.acceleo.module.sample.services.Service', '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){
		        list2.add(parameter1.getName());	
	        } 
		list.add(met.getName() +"(" + list2 + ")");
		list2.clear();
        }
        return list;
}

Then the query in the mtl file.
[query public getAList(arg0 : String) : Sequence(OclAny)
	= invoke('org.eclipse.acceleo.module.sample.services.Service', 'getAList(java.lang.String)', Sequence{arg0})
/]

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


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: Fri Dec 06 16:53:43 GMT 2024

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

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

Back to the top