Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Default value literal
Default value literal [message #781048] Fri, 20 January 2012 08:01 Go to next message
Martin  odloucký is currently offline Martin odlouckýFriend
Messages: 49
Registered: July 2010
Member
Hello,

I need a default value for a 0..1 reference to be generated from my model definition. The default value is an instance of some class in the model. I tried to use default value literal but I do not quite understand what to type in there since it is a textual information. I googled and searched but have found only very little explanation of how the default value literal is used.

Thank you
Re: Default value literal [message #781174 is a reply to message #781048] Fri, 20 January 2012 08:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 29119
Registered: July 2009
Senior Member
Martin,

Comments below.

On 20/01/2012 9:01 AM, Martin odloucký wrote:
> Hello,
> I need a default value for a 0..1 reference to be generated from my
> model definition.
References can't have static defaults.
> The default value is an instance of some class in the model.
What resource contains that instance?
> I tried to use default value literal but I do not quite understand
> what to type in there since it is a textual information. I googled and
> searched but have found only very little explanation of how the
> default value literal is used.
You'll need to modify generated code for computing defaults. You could
look at EGenericTypeImpls use of eJavaObject as an example.
> Thank you
Re: Default value literal [message #1766090 is a reply to message #781174] Thu, 15 June 2017 14:41 Go to previous messageGo to next message
Veselin Markov is currently offline Veselin MarkovFriend
Messages: 8
Registered: February 2012
Junior Member
Meanwhile it is 8 years later: Is it still true, that it's not possible to model a default value literal on a EAttribite in a EClass and the default value literal be an instance of another EClass from the same model?

Edit: I have to correct my question:

I didn't mean an EAttribute but EReference. Sorry

[Updated on: Thu, 15 June 2017 15:13]

Report message to a moderator

Re: Default value literal [message #1766093 is a reply to message #1766090] Thu, 15 June 2017 15:13 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5579
Registered: July 2009
Senior Member
Hi

In 'pure EMF' you can model it via a custom Java action.

In 'pure modeling' you could exploit the experimental support for shadow objects (object construction) in OCL to model it via an OCL default value.

Regards

Ed Willink
Previous Topic:Error: There may not be two classifiers named 'CatchClause_CatchClause'
Next Topic:How to define xml name and plural name of a TAG
Goto Forum:
  


Current Time: Thu Jan 18 12:09:21 GMT 2018

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

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