java - In around avice, how to get the 'type parameter' of a parameter of the advised method -


With Spring AOP, I'm writing an around that the @MyAnnotation . Suppose that the blocking method was declared as follows:

  @My annotation public string Some method (ArrayList & lt; Integer & gt; arrList) {...}  < / pre> 

Method in the advice, I have to get the information that the first parameter, i.e. arrList , type ArrayList type parameter with Integer .

I have tried the following by doing this

  @ around ("@notation") Public Objective Advice (Proceedings JointPoint PJP) {Method method = (( MethodSignature) pjp.getSignature ()) getMethod () .; Classroom & lt ;? & Gt; [] Parameters class = method.getParameterTypes (); Logger.info (((ParamyTermetime) Parameters Class [0] .getGenericSuperclass (). GetActualTypeArguments () [0]) ...}   

But the one who logged out was just a < The code is> e . How do I insist that it is java.lang.Integer

< P prints> Try it:
  @Around ("@notation (mynotation)" throws public object advice (ProdeningJointPoint PJP) thrownable (method method = (method approval) pjp. getSignature ()). [] genericParamsClass = method.getGenericParameterTypes (); Logger.info ((Parameter Type) Generic Parameters Class [0]. GetActualTypeArguments () [0]; ...}    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -