Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Ecore defaultValue for EByteArray or EFloat with multiplicities
Ecore defaultValue for EByteArray or EFloat with multiplicities [message #1226878] Fri, 03 January 2014 00:29 Go to next message
Klaus Meiner is currently offline Klaus MeinerFriend
Messages: 6
Registered: January 2014
Junior Member
Hi,

I have a question regarding to the default values in an ecore model:

Is it possible to set a default value for an attribute of type
EByteArray 
(with upper and lower bound = 3) or for an attribute of type
EFloat
(with upper and lower bound = 3)?

When I try that I get only something like:

The default value literal ... must be a valid literal of the attribute's type.



Thanks, Meiner.
Re: Ecore defaultValue for EByteArray or EFloat with multiplicities [message #1227105 is a reply to message #1226878] Fri, 03 January 2014 15:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 26616
Registered: July 2009
Senior Member
No, you can't specify default values for multi-valued features. In both
these cases, I suspect you should be defining an EDataType to represent
a byte[] or float "tuple" and then you're dealing again with a
single-valued feature which can have a default value.

On 03/01/2014 2:22 PM, Klaus Meiner wrote:
> Hi,
>
> I have a question regarding to the default values in an ecore model:
>
> Is it possible to set a default value for an attribute of type
> EByteArray (with upper and lower bound = 3) or for an attribute of
> type EFloat (with upper and lower bound = 3)?
>
> When I try that I get only something like:
>
> The default value literal ... must be a valid literal of the
> attribute's type.
>
>
> Thanks, Meiner.
Re: Ecore defaultValue for EByteArray or EFloat with multiplicities [message #1694614 is a reply to message #1227105] Wed, 06 May 2015 16:29 Go to previous message
darrel karisch is currently offline darrel karischFriend
Messages: 6
Registered: July 2012
Junior Member
How can one provide a default attribute value for a generic type?

for generic types a create???FromString is generated but never invoked despite including a default String value in an ecore model.

e.g.
genericType.ecore defines generic type

example.ecore includes a genericType with default String value

It appears that the implementation does not handle default generic type values.

since EDataType will not have any reference to the required type it appears that it is not doable. create???FromString would require some kind of "hint" for the types required.

Nevertheless, initializePackageContents does record the default String Literal for the generic type attribute. Is it not possible to have a create???FromString using the Attribute argument so the correct type information can be derived for a new instance?

[Updated on: Wed, 06 May 2015 16:56]

Report message to a moderator

Previous Topic:How can I implement attribute propagation in EMF?
Next Topic:Save a copy of a Resource - xmi:id missing
Goto Forum:
  


Current Time: Sat May 30 04:56:01 GMT 2015

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

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