Using a Generic MetaClass Name ?! [message #90566] |
Fri, 26 September 2008 05:51  |
Eclipse User |
|
|
|
Hi,
I would like to write a generic rule that calls a helper that computer the
type of the metaclass that will be generated, i wrote this code (that
doesn't work):
helper context UML2!Class def : GenericComponentName () :
AAXL!ComponentClassifier =
if self.isStereotypeApplied('MemoryPartition') then
AAXL!MemoryType
else if self.isStereotypeApplied('SwSchedulableResource') then
AAXL!ProcessType
else
AAXL!ComponentClassifier
endif
endif ;
rule ClassGeneric {
from a: UML2!Class (a.isAbstract())
--ERROR HERE-- to p: oclType(a.GenericComponentName())(name <- a.name)}
It seems that this is impossible to do this way because of the way ATL
computes the atl transformation file, does anybody have an idea of how to
do this?
|
|
|
[ATL] Re: Using a Generic MetaClass Name ?! [message #90834 is a reply to message #90566] |
Wed, 01 October 2008 05:35  |
Eclipse User |
|
|
|
Hello,
The "to" part of the rule can't be parametrized, you need to do that in
another way. For instance :
rule Class2MemoryType {
from a: UML2!Class (
a.isAbstract() and a.isStereotypeApplied('MemoryPartition'))
to p: AAXL!MemoryType ()
}
rule ClassGeneric {
from a: UML2!Class (
a.isAbstract() and a.isStereotypeApplied('
etc...
Best regards,
William
Skander a écrit :
> Hi,
> I would like to write a generic rule that calls a helper that computer
> the type of the metaclass that will be generated, i wrote this code
> (that doesn't work):
>
> helper context UML2!Class def : GenericComponentName () :
> AAXL!ComponentClassifier =
> if self.isStereotypeApplied('MemoryPartition') then
> AAXL!MemoryType
> else if self.isStereotypeApplied('SwSchedulableResource') then
> AAXL!ProcessType
> else
> AAXL!ComponentClassifier
> endif
> endif ;
>
> rule ClassGeneric {
> from a: UML2!Class (a.isAbstract())
> --ERROR HERE-- to p: oclType(a.GenericComponentName())(name <- a.name)}
>
> It seems that this is impossible to do this way because of the way ATL
> computes the atl transformation file, does anybody have an idea of how
> to do this?
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.07176 seconds