Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » equals-operation on custom datatypes
equals-operation on custom datatypes [message #513214] Tue, 09 February 2010 11:53 Go to next message
RJ is currently offline RJFriend
Messages: 19
Registered: October 2009
Location: Eindhoven, The Netherland...
Junior Member
Hi all,

I was directed to this forum with my question, though I'm not really sure it is the correct place to ask. I'm just hoping someone can help me.

I created a custom datatype to represent Strings, let's call it XString. I did this so that I could put a constraints on the allowed characters in the XString. So I added a datatype to my Ecore model, and set the Instance Class Name to java.lang.String

However, now I get an error when I want to compare XStrings in .ext files:

Could find operation '==(Model::XString)' for type 'Model:XString'


While it is true that I did not define this operation, I kind of hoped it was implied by setting the instance class to java.lang.String. But apparently this is not the case.

So my question now is, what to do? Where do I define the equals operation? Or do I have to link my datatype to the standard String datatype in another way?

Thanks in advance
Re: equals-operation on custom datatypes [message #513293 is a reply to message #513214] Tue, 09 February 2010 11:46 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Xtend (and Xpand) have four built-in datatypes, String being one of
them. In the metamodel you can map implementation-specific datatypes to
those built-in types. For instance the EmfRegistryMetamodel maps
ecore::EString to the builtin String, the UML2 meta model maps
uml2::String to it.

You'll have to do the same if you really need this custom String.

Sven


RJ schrieb:
> Hi all,
>
> I was directed to this forum with my question, though I'm not really
> sure it is the correct place to ask. I'm just hoping someone can help me.
>
> I created a custom datatype to represent Strings, let's call it XString.
> I did this so that I could put a constraints on the allowed characters
> in the XString. So I added a datatype to my Ecore model, and set the
> Instance Class Name to java.lang.String
>
> However, now I get an error when I want to compare XStrings in .ext files:
>
> Could find operation '==(Model::XString)' for type 'Model:XString'
>
>
> While it is true that I did not define this operation, I kind of hoped
> it was implied by setting the instance class to java.lang.String. But
> apparently this is not the case.
>
> So my question now is, what to do? Where do I define the equals
> operation? Or do I have to link my datatype to the standard String
> datatype in another way?
>
> Thanks in advance


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: equals-operation on custom datatypes [message #513444 is a reply to message #513214] Wed, 10 February 2010 09:26 Go to previous message
RJ is currently offline RJFriend
Messages: 19
Registered: October 2009
Location: Eindhoven, The Netherland...
Junior Member
Ok tnx, that is clear now. I was hoping that I could map my new String to ecore::EString, and that that would do the trick. But I'll go digging through the EMFRegistryMetaModel now.
Previous Topic:[Xpand] unresolved proxy referincing a model with "platform:/plugin/..." schema
Next Topic:UML Profile and UML Version 3.0.0
Goto Forum:
  


Current Time: Tue Apr 23 11:42:57 GMT 2024

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

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

Back to the top