|
Re: Property#setDefaultValue of EnumerationLiteral [message #1563991 is a reply to message #1563544] |
Wed, 14 January 2015 14:35 |
|
Hi, Andreas,
Try this:
-------- 8< --------
p.createDefaultValue(null, A_LITERAL.enumeration,
UMLPackage.Literals.INSTANCE_VALUE) as InstanceValue => [
instance = A_LITERAL
]
-------- >8 --------
A value of enumeration type is represented by an InstanceValue, because
EnumerationLiterals are InstanceSpecifications of their Enumeration
types.
HTH,
Christian
On 2015-01-14 08:59:23 +0000, Andreas Jakobik said:
> Hi,
> I'm trying to set a Property defaultValue to an EnumerationLiteral.
> However, after the following code has been executed, the enum literal
> specification value is null, and the default value shows a 0.
> Here is xtend code snippet:
>
> val EnumerationLiteral A_LITERAL = // lookup of enumeration literal
> val Property p = // lookup of class property (which has a Enumeration as type)
>
> // The following line calls void
> org.eclipse.uml2.uml.Property.setDefaultValue(ValueSpecification value)
> p.defaultValue = A_LITERAL.specification
> What is wrong? How do I correctly assign an enumeration literal as a
> default value?
>
> I'm using an old version of UML2 api (Version: 3.1.2.v201010261927) on
> IBM RSA 8.0.4.
>
> Thanks a lot!
>
> /Andreas
|
|
|
|
Powered by
FUDForum. Page generated in 0.03933 seconds