[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [ATL] NullPointerException--ERROR

Hi Rasha,

First, do you pass the definition of the profile (which is a UML model) as an input of your transformation?

Rasha a Ãcrit :
I have only another helper ïhasStereotypeï which I tested separately and works fine. I attached the whole transformation file.


---This helper define the method "hasStereotype" helper context UML!"uml::Element" def: hasStereotype(stereotype : String) : Boolean = self.getAppliedStereotypes()-> exists (c | c.name = stereotype);

---This helper define the method "getTaggedValue"
helper context UML!"uml::Element" def: getTaggedValue(stereo :
String ,tag : String) : UML!"uml::Element" =
self.getValue(self.getAppliedStereotype(stereo),tag);


Are you sure the getValue method is actually returning a uml::Element?
What happens if the property of the given stereotype is of type String or Integer?


---This helper verifies if the value of the proterty 'myProperty' is different of 'value1'
helper context UML!"uml::Element" def : checkMyPropertyValue() : Boolean =
if (self.hasStereotype('MyStereotype')) then
if (self.getTaggedValue('MyStereotype','myProperty')<>'value1') then
true
else false
endif
else
true
endif;


rule Copyclass{
    from
        s : UML!Class   (s.checkMyPropertyValue())
    to           t : UML!Class(             name <- s.name
        )
}


Best Regards,

Rasha



Best regards,

Hugo


-- -------------------------------------------------------- Hugo Bruneliere - R&D Engineer ATLAS Group (INRIA & LINA) - University of Nantes 2, rue de la Houssiniere 44322 Nantes Cedex 3 - France office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30 EMail: Hugo.Bruneliere@xxxxxxxxxxxxxx http://www.sciences.univ-nantes.fr/lina/atl/ --------------------------------------------------------