|
|
Re: [Texo] generating a default value for an attribute [message #1437655 is a reply to message #1436700] |
Sat, 04 October 2014 16:17  |
Eclipse User |
|
|
|
Am 03.10.2014 um 11:23 schrieb Martin Taal:
> Hi Ralf,
> Missed your post... I tested it for int/string/enum and for all 3 the
> default value worked. What type is your eattribute?
>
> Here are my examples:
>
> private String title = "TEST";
>
> /**
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> *
> * @generated
> */
> private int pages = 100;
>
> /**
> * <!-- begin-user-doc --> <!-- end-user-doc -->
> *
> * @generated
> */
> private BookCategory category = BookCategory.SCIENCEFICTION;
>
>
>
> gr. Martin
>
> On 25-09-14 23:10, Ralf Heydenreich wrote:
>> Hi all,
>> I've set a default value for an attribute in my ecore model file. But if
>> I generate the Java code there's no assignment of this value. How do I
>> create it in the right way?
>>
>> TIA,
>> Ralf.
>>
>
>
Hi Martin,
thanks for your answer. Now, I've tested it with EBooleanObject value
and it works as expected. But I have to use the simple type version
("true/false") instead of "Boolean.TRUE" or "Boolean.FALSE".
It does not work if I use EIntegerObject. Whether if I use
"java.lang.Integer.valueOf(1)" nor if I use the simple "1" as Default
Value Literal.
Are the default values only useable with simple types?
Greetz,
Ralf.
|
|
|
Powered by
FUDForum. Page generated in 0.04276 seconds