|
Re: [ACCELEO] Generate Declarations [message #1684181 is a reply to message #1681833] |
Wed, 18 March 2015 10:14 |
Eclipse User |
|
|
|
Dear Frank,
If you want to filter those who are not ports usually in the "for"
clause you should use some OCL. Something like:
[for (property :Property | c.ownedElement->select(p |
p.oclIsKindOf(Property) and not p.oclIsKindOf(Port)))]
[PropertyDeclarations(property)/]
[/for]
For the Real literal to be shown, please, try using explicitly
".toString()" for defaultValue.
Best,
Víctor
El 17/03/2015 a las 15:31, Frank W. escribió:
> Hi,
>
> I want to generate simple declarations with Acceleo in one of these two
> ways:
>
> 1.
> [for (property :Property | c.eContents(Property))]
> [PropertyDeclarations(property)/]
> [/for]
>
> [template public PropertyDeclarations(property:Property)]
> [property.type.getStereotypeValue('Ecore::EDataType',
> 'instanceClassName')/] [property.name/] = [property.defaultValue/];
> [/template]
>
> 2.
> [c.attribute.type.getStereotypeValue('Ecore::EDataType',
> 'instanceClassName')/][c.attribute.name/];
>
> Output
> 1. Yields this as the output
> double in = ;
> double out = ;
> double v0_ =
> mailto:org.eclipse.uml2.uml.internal.impl.LiteralRealImpl@7b87d668
> (name: <unset>, visibility: <unset>) (value: 0.0);
> double v1_ =
> mailto:org.eclipse.uml2.uml.internal.impl.LiteralRealImpl@d18c0be (name:
> <unset>, visibility: <unset>) (value: 1.0);
>
> So here I only want to consider the properties which are not ports:
> meaning 'in' and 'out'
> And I want to access the values 0.0 and 1.0 respectively, but it does
> not work with [property.defaultValue.value/].....
>
> 2. If I try it another way with the code in 2. I get the following:
> doubledoubledoubledouble inoutv0_v1_;
>
> So basically I am wanting to know how I can change the code to get just
> the Parameters without the ports (I used the Parameter Property under
> Contraints and Comments) and in the right order, like this:
>
> double v0_;
> double v1_;
>
> Thank you,
> Frank
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03214 seconds