How about:

@Before("execution(public * *(List<VEHICLE+>, ..))  && args(firstArgument,..) ")
public void provideAdviseUponMethodInvocation( List<? extends VEHICLE>
 firstArgument , JoinPoint jp )

as shown in this example:
===
import java.util.List;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;


public aspect Test {
        public void planes(List<Plane> planes) {        } // does not match
        public void cars(List<Car> cars) {      } // matches
        public void buses(List<Bus> buses) {    } // matches
}

@Aspect
class Azpect {
        @Before("execution(public * *(List<Vehicle+>, ..))  &&
args(firstArgument,..) ")
        public void provideAdviseUponMethodInvocation( List<? extends
Vehicle>  firstArgument , JoinPoint jp ) {
        }
}
        
class Vehicle {}
class Car extends Vehicle {}
class Bus extends Vehicle {}
class Plane {}
===

Andy

On 26 April 2011 15:29, Srinivas S Tamvada <tssrini...@yahoo.com> wrote:
> Hi
> I am trying to match methods which take list arguments.
> I am interested only in list of "vehicles" or subtypes.
>
> Below does not seem to match. Any comments will be appreciated.
> Seems okay according to 
> http://www.eclipse.org/aspectj/doc/released/adk15notebook/generics-inAspectJ5.html.
>
>
>
> Thanks,
> -SST
>
> @Before("execution(public * *(List<VEHICLE+>, ..))  && args(firstArgument,..) 
> ")
>    public void provideAdviseUponMethodInvocation( List<VEHICLE>  
> firstArgument , JoinPoint jp )
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to