Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend] Java parameter types
[Xtend] Java parameter types [message #531602] Wed, 05 May 2010 10:04 Go to next message
Eclipse UserFriend
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 10:11 Go to previous messageGo to next message
Eclipse UserFriend
Hello Ralf,

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

~Christian
Re: [Xtend] Java parameter types [message #531633 is a reply to message #531603] Wed, 05 May 2010 11:55 Go to previous messageGo to next message
Eclipse UserFriend
> 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 13:23 Go to previous message
Eclipse UserFriend
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

Previous Topic:Escaping Strings in Xpand
Next Topic:[XPand] Passing context / parameters through expansions
Goto Forum:
  


Current Time: Tue Jul 22 20:05:06 EDT 2025

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

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

Back to the top