calling a java extension from inside an Xpand file [message #57052] |
Sun, 08 February 2009 07:44  |
Eclipse User |
|
|
|
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 08:12  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.05563 seconds