Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] Java parameter types
[Xtend] Java parameter types [message #531602] Wed, 05 May 2010 14:04 Go to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
I'm wondering what the rules for Xtend parameter types are, i.e. why Date is not allowed here:

// this is ok
String ddmmyyyy(Object date) : JAVA com.example.Dates.ddmmyyyy(java.util.Date);

// Type not found: Date
String ddmmyyyy(Date date) : JAVA com.example.Dates.ddmmyyyy(java.util.Date);
String ddmmyyyy(java.util.Date date) : JAVA com.example.Dates.ddmmyyyy(java.util.Date);

I checked the help chapter on Xtend and could find no definition what makes a valid
parameter type. Object works so far, but it's annoying because if you define date
formatting functions, each and every object has them available in the editor. What are the
rules here?

- Ralf | http://www.ralfebert.de/
Re: [Xtend] Java parameter types [message #531603 is a reply to message #531602] Wed, 05 May 2010 14:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
Hello Ralf,

which metamodel are you using. xtend has not built-in type Date.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [Xtend] Java parameter types [message #531633 is a reply to message #531603] Wed, 05 May 2010 15:55 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 168
Registered: July 2009
Senior Member
> which metamodel are you using. xtend has not built-in type Date.

ecore/EmfRegistryMetaModel. As all the help examples were using String and Object and not
EString and EObject I assumed we're talking about Java types here. Specifying ecore::EDate
as parameter type validates but fails at runtime with 'EvaluationException : Couldn't find
operation 'ddmmyyyy()' for Object.'.

- Ralf | http://www.ralfebert.de/
Re: [Xtend] Java parameter types [message #531653 is a reply to message #531633] Wed, 05 May 2010 17:23 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14664
Registered: July 2009
Senior Member
Hello Ralf,

when adding the JavaMetaModel

String test(java::util::Date d) :
JAVA Test.test(java.util.Date);

works for me. (in older xpand versions there might be error markers in the editor)

~Christian



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Escaping Strings in Xpand
Next Topic:[XPand] Passing context / parameters through expansions
Goto Forum:
  


Current Time: Tue Apr 16 10:34:48 GMT 2024

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

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

Back to the top