Ah no wonder, I guess I didn't read that close enough, I thought you wanted the parameter stereotype and not the parameter type's stereotype. I'm glad you got it working.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, March 03, 2005 12:51 AM To: [email protected] Subject: RE: [Andromda-devel] Finding out the stereotype of the type of a method parameter Hi, just wanted to let you know what the problem really was: 1) For what I was going to do, the right snipped looks like this: OperationFacade operation = (OperationFacade)object; Collection parameters = operation.getParameters(); for (Iterator iter = parameters.iterator(); iter.hasNext();) { ParameterFacade parameter = (ParameterFacade) iter.next(); ClassifierFacade type = parameter.getType(); if (type.hasStereotype(UMLProfile.STEREOTYPE_SEARCH)) return true; } } So, I just forgot to navigate into the type. Remember, I wanted to find out the stereotype of the *class* of the parameter, not of the parameter itself... 2) My XMI file didn't contain the stereotype information in the correct format. Guess I'll have to adjust my XMI export filter to be more XMI compliant :-) Anyhow, thanks for looking at my code. - Peter >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] Behalf Of Chad >Brandon >Sent: Wednesday, March 02, 2005 8:27 PM >To: FRIESE, PETER; [email protected] >Subject: RE: [Andromda-devel] Finding out the stereotype of the type of >a method parameter > > >Hmm...that should work. If you'd like you can send me your >project and I >can take a closer look. > >-----Original Message----- >From: [EMAIL PROTECTED] >[mailto:[EMAIL PROTECTED] On Behalf Of >[EMAIL PROTECTED] >Sent: Wednesday, March 02, 2005 12:13 PM >To: [email protected] >Subject: RE: [Andromda-devel] Finding out the stereotype of >the type of a >method parameter > >Hi Chad, > >that was what I tried before I asked :-( > >Here's a snippet of my code: > > > protected Collection handleGetCriteriaFinders() > { > Collection finders = this.getOperations(); > > return new FilteredCollection(finders) > { > /** > * Check whether at least one of the method arguments is >stereotyped as STEREOTYPE_SEARCH. > * > * @see >org.apache.commons.collections.Predicate#evaluate(java.lang.Object) > */ > public boolean evaluate(Object object) > { > OperationFacade operation = (OperationFacade)object; > > Collection parameters = operation.getParameters(); > for (Iterator iter = parameters.iterator(); >iter.hasNext();) > > { > ModelElementFacade parameter = (ModelElementFacade) >iter.next(); > System.out.println("------ Parameter: " + >parameter); > for (Iterator iterator = >parameter.getStereotypes().iterator(); iterator > .hasNext();) { > Object stereo = iterator.next(); > System.out.println("--------- Stereotype: " + >stereo); > } > if >(parameter.hasStereotype(UMLProfile.STEREOTYPE_SEARCH)) > { > return true; > } > } > > return false; > } > }; > } > >On the system log, it returns this: > [andromda] --- Operation: >org.andromda.cartridges.spring.metafacades.SpringQueryOperation >LogicImpl[fin >dByKunde] > [andromda] ------ Argument: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[name] > [andromda] ------ Parameter: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[return] > [andromda] ------ Parameter: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[name] > [andromda] --- Operation: >org.andromda.cartridges.spring.metafacades.SpringEntityOperatio >nLogicImpl[fi >ndBySearch] > [andromda] ------ Argument: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[buchung >enSearch] > [andromda] ------ Parameter: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[return] > [andromda] ------ Parameter: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[buchung >enSearch] > [andromda] --- Operation: >org.andromda.cartridges.spring.metafacades.SpringQueryOperation >LogicImpl[fin >dAll] > [andromda] ------ Parameter: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[return] > [andromda] --- Operation: >org.andromda.cartridges.spring.metafacades.SpringQueryOperation >LogicImpl[fin >dByStatus] > [andromda] ------ Parameter: >org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[return] > > >Maybe I wasn't clear enough with what I was trying to do: I >want to find all >methods that are finders and that do have at least one parameter whose >referenced class has been stereotyped as a criteria search. > >- Peter > >>-----Original Message----- >>From: Chad Brandon [mailto:[EMAIL PROTECTED] >>Sent: Wednesday, March 02, 2005 4:56 PM >>To: FRIESE, PETER; [email protected] >>Subject: RE: [Andromda-devel] Finding out the stereotype of >the type of >>a method parameter >> >> >>Just do this: >> >>ParameterFacade.hasStereotype("stereotype name") >> >> >> >>-----Original Message----- >>From: [EMAIL PROTECTED] >>[mailto:[EMAIL PROTECTED] On Behalf Of >>[EMAIL PROTECTED] >>Sent: Wednesday, March 02, 2005 8:51 AM >>To: [email protected] >>Subject: [Andromda-devel] Finding out the stereotype of the >>type of a method >>parameter >> >>Hi, >> >>I need to find out which stereotypes the type of a method >>parameter has. >> >>E.g.: >> >>class PersonCriteria is stereotyped as <<SearchCriteria>> in the model >> >>Now I have a method "findByCriteria(PersonCriteria criteria)" >>on a Spring >>entity. Inside the metafacade for the Spring entity, I want to >>find out that >>the class PersonCriteria is stereotyped with <<SearchCriteria>>. >> >>But how? I tried to iterate all arguments, get their types and >>list their >>stereotypes, but to no avail. >> >>- Peter >> >> >>------------------------------------------------------- >>SF email is sponsored by - The IT Product Guide >>Read honest & candid reviews on hundreds of IT Products from >>real users. >>Discover which products truly live up to the hype. Start reading now. >>http://ads.osdn.com/?ad_ide95&alloc_id396&op=ick >>_______________________________________________ >>Andromda-devel mailing list >>[email protected] >>https://lists.sourceforge.net/lists/listinfo/andromda-devel >> >> >> > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from >real users. >Discover which products truly live up to the hype. Start reading now. >http://ads.osdn.com/?ad_ide95&alloc_id396&op=ick >_______________________________________________ >Andromda-devel mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/andromda-devel > > > > >------------------------------------------------------- >SF email is sponsored by - The IT Product Guide >Read honest & candid reviews on hundreds of IT Products from >real users. >Discover which products truly live up to the hype. Start reading now. >http://ads.osdn.com/?ad_ide95&alloc_id396&op=ick >_______________________________________________ >Andromda-devel mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/andromda-devel > ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=ick _______________________________________________ Andromda-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-devel ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Andromda-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/andromda-devel
