Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » calling a java extension from inside an Xpand file
calling a java extension from inside an Xpand file [message #57052] Sun, 08 February 2009 12:44 Go to next message
Philipp Zech is currently offline Philipp ZechFriend
Messages: 96
Registered: July 2009
Member
Hi, again me,

I have the following problem. During the generation of java code out of
an activity diagram I use various extensions written in Java called
through Xtend. The part of the template file calling the extension looks
like the following:

«DEFINE ProcessStoryActivity FOR uml::Activity»
«LET getInitialNode(this) AS initNode»

«ENDLET»
«ENDDEFINE»

the defined extension in the Xtend file looks like:

org.eclipse.uml2.uml::InitialNode getInitialNode(uml::Activity act) :
JAVA template.Teststories.getInitialNode(org.eclipse.uml2.uml.Act ivity);

and the according implementation pof the java file has the following
signature:

package template;

import java.util.Iterator;

import org.eclipse.emf.common.util.EList;
import org.eclipse.uml2.uml.Activity;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.InitialNode;

public class Teststories {

/**
* Returns the initial node of the activity diagram.
*
* @param act
* the activity diagram
* @return the inital node
*/
public static InitialNode getInitialNode(Activity act) {
....
}
}

So far everything seems to look ok for me, but now when i try to run the
generator file i get the following error:

5393 ERROR AbstractExpressionsUsingWorkflowComponent - Error in
Component generator of type org.openarchitectureware.xpand2.Generator:
EvaluationException : mismatched input '.' expecting '(' on line 1
template::Teststories.xpt[1565,35] on line 59
'getInitialNode((uml::Activity)this)'

this means that somehow i can't call the extension the way i'm doing it,
but unfortunately I can't figure out why. Has anyboday probably got a
hint for me, why this error occurrs?

Thanks a lot!

cheers,

Philipp
Re: calling a java extension from inside an Xpand file [message #57111 is a reply to message #57052] Sun, 08 February 2009 13:12 Go to previous message
Philipp Zech is currently offline Philipp ZechFriend
Messages: 96
Registered: July 2009
Member
Philipp Zech schrieb:
> Hi, again me,
>
> I have the following problem. During the generation of java code out of
> an activity diagram I use various extensions written in Java called
> through Xtend. The part of the template file calling the extension looks
> like the following:
>
> «DEFINE ProcessStoryActivity FOR uml::Activity»
> «LET getInitialNode(this) AS initNode»
>
> «ENDLET»
> «ENDDEFINE»
>
> the defined extension in the Xtend file looks like:
>
> org.eclipse.uml2.uml::InitialNode getInitialNode(uml::Activity act) :
> JAVA
> template.Teststories.getInitialNode(org.eclipse.uml2.uml.Act ivity);
>
> and the according implementation pof the java file has the following
> signature:
>
> package template;
>
> import java.util.Iterator;
>
> import org.eclipse.emf.common.util.EList;
> import org.eclipse.uml2.uml.Activity;
> import org.eclipse.uml2.uml.Element;
> import org.eclipse.uml2.uml.InitialNode;
>
> public class Teststories {
>
> /**
> * Returns the initial node of the activity diagram.
> *
> * @param act
> * the activity diagram
> * @return the inital node
> */
> public static InitialNode getInitialNode(Activity act) {
> ....
> }
> }
>
> So far everything seems to look ok for me, but now when i try to run the
> generator file i get the following error:
>
> 5393 ERROR AbstractExpressionsUsingWorkflowComponent - Error in
> Component generator of type org.openarchitectureware.xpand2.Generator:
> EvaluationException : mismatched input '.' expecting '(' on line 1
> template::Teststories.xpt[1565,35] on line 59
> 'getInitialNode((uml::Activity)this)'
>
> this means that somehow i can't call the extension the way i'm doing it,
> but unfortunately I can't figure out why. Has anyboday probably got a
> hint for me, why this error occurrs?
>
> Thanks a lot!
>
> cheers,
>
> Philipp
again resolved,

the reason was that the return type of the declared extension has to be
written like:

uml::InitialNode getInitialNode(uml::Activity act) :
JAVA
template.Teststories.getInitialNode(org.eclipse.uml2.uml.Act ivity);

have a nice sunday everybody
Previous Topic:Xpand: invoking getValue() leads to an invocation target exception
Next Topic:[Announce] M2T XPAND 0.7.0 I200902120614 is available
Goto Forum:
  


Current Time: Thu Apr 18 10:11:51 GMT 2024

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

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

Back to the top