Skip to main content



      Home
Home » Modeling » EMF » Ecore defaultValue for EByteArray or EFloat with multiplicities
Ecore defaultValue for EByteArray or EFloat with multiplicities [message #1226878] Thu, 02 January 2014 19:29 Go to next message
Eclipse UserFriend
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 10:02 Go to previous messageGo to next message
Eclipse UserFriend
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 12:29 Go to previous message
Eclipse UserFriend
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 12:56] by 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: Wed Jul 23 18:14:05 EDT 2025

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

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

Back to the top