Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How pass string array[] as argument of a java service wrapper in acceleo ?
How pass string array[] as argument of a java service wrapper in acceleo ? [message #1786826] Sun, 13 May 2018 14:43 Go to next message
mamad . is currently offline mamad .Friend
Messages: 15
Registered: March 2018
Junior Member
Hi guys,
i want to write a java service for doing some thing with a String array[] and i dont know how write proper query for passing String array as argument ?

This is my java service :
package modeldriven.java.services;
public class Service2 {
	public String join(String [] sequence){
		String output="";
		for (int i = 0; i < sequence.length; i++) {
			output+=sequence[i];
		}
		return output;
	}
}

and this is the query that generated automatically for calling that service:
[comment encoding = Cp1256 /]
[module generate('http://www.MyMetaModel.com')/]

[query public join(arg0 : String[]) : String
	= invoke('modeldriven.java.services.Service2', 'join()', Sequence{arg0})
/]

this query gives some errors like
Invalid Type: String[]
and
Incomplete reference to variable declaration in variable expression: (arg0)

Whats the problem ?
Thanks in advance






Re: How pass string array[] as argument of a java service wrapper in acceleo ? [message #1786829 is a reply to message #1786826] Sun, 13 May 2018 16:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Have you read the Acceleo documentation? IIRC it defines the calling protocols. I suspect you have to use Sequence <=> List.

Regards

Ed Willink
Re: How pass string array[] as argument of a java service wrapper in acceleo ? [message #1786835 is a reply to message #1786829] Sun, 13 May 2018 23:39 Go to previous messageGo to next message
mamad . is currently offline mamad .Friend
Messages: 15
Registered: March 2018
Junior Member
yeah i have read Acceleo Documentation but did not find any thing about how to pass arrays as argument for a java service wrappers
i try a little fix in query as shown below :
[query public join(arg0 : Sequence(String)) : String
	= invoke('modeldriven.java.services.Service2', 'join(Sequence(java.lang.String))', Sequence{arg0})
/]

but still there is an error.it says :
One of the parameters' class couldn't be loaded for method join(Sequence(java.lang.String)) of class modeldriven.java.services.Service2.
Re: How pass string array[] as argument of a java service wrapper in acceleo ? [message #1786839 is a reply to message #1786835] Mon, 14 May 2018 05:38 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

IIRC using invoke is painful because there is no compile-time diagnosis of easily made and easily diagnosed errors. (https://bugs.eclipse.org/bugs/show_bug.cgi?id=319252#c2 seems to have been overlooked when the Bugzilla was closed). You must therefore debug by empathy or Java single stepping.

Regards

Ed Willink
Previous Topic:Acceleo transformation
Next Topic:Convert Sequence to String in Acceleo
Goto Forum:
  


Current Time: Thu Mar 28 15:54:08 GMT 2024

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

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

Back to the top