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.SpringQueryOperationLogicImpl[findByKunde]
[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.SpringEntityOperationLogicImpl[findBySearch]
[andromda] ------ Argument:
org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[buchungenSearch]
[andromda] ------ Parameter:
org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[return]
[andromda] ------ Parameter:
org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[buchungenSearch]
[andromda] --- Operation:
org.andromda.cartridges.spring.metafacades.SpringQueryOperationLogicImpl[findAll]
[andromda] ------ Parameter:
org.andromda.metafacades.uml14.ParameterFacadeLogicImpl[return]
[andromda] --- Operation:
org.andromda.cartridges.spring.metafacades.SpringQueryOperationLogicImpl[findByStatus]
[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=click
_______________________________________________
Andromda-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/andromda-devel