|Current date as default [message #381195]
||Sun, 26 August 2007 08:31
Originally posted by: office.dapissarenko.com|
In my EMF model I have a class with an EDate attribute. I want this
attribute to have a default value. This default value should be the date,
on which the instance of this class was created (new Date() in plain Java).
How can I do this in the model (*.ecore) ?
Thanks in advance
|Re: Current date as default [message #599327 is a reply to message #381195]
||Sun, 26 August 2007 12:22
| Ed Merks
Registered: July 2009
Please use the EMF newsgroup, which I've added to the "to" list of the
reply, for questions specifically about EMF. You can't model this
directly just via Ecore because default values are expected to be
constants. You could specialize the field declaration in the Impl class
by marking it with @generated NOT and assigning a new Date() to it
there. Keep in mind that this will create a date instance at the time
the EObject is constructed and that this Date instance will likely be
replaced if this object is created as part of deserialization when that
serialized instance also has a date.
Dmitri Pissarenko wrote:
> In my EMF model I have a class with an EDate attribute. I want this
> attribute to have a default value. This default value should be the
> date, on which the instance of this class was created (new Date() in
> plain Java).
> How can I do this in the model (*.ecore) ?
> Thanks in advance
> Dmitri Pissarenko
Powered by FUDForum
. Page generated in 0.01801 seconds