java - When using spring aop:around, how can I get return type of the pointcut method? -
itemprop = "text">
I now have a requirement, that is when Myabatis (especially those batch executes SQL), check the first parameter, if the parameter is empty Or is empty, then just return, go ahead and if there is a return type list, like
list & lt; Users & gt; Returns the empty arreelist if the type of return is zero:
Zero Batch Insert (List & lt; User & gt;) Code>
The return tap objective is to avoid this situation, such as
select from user * where id () is user (name , Email) Enter value () But joining can not return to me type, only Args can be received.
object [] args = joinPoint.getArgs (); If (args! = Null & args.length = 1) {if (args [0] list of examples) {if (((list) obj) .isEmpty ()) {if (ReturnType.equals ("java. Util .list ")) Return new array list (); Otherwise if (ReturnType.equals ("zero")) an empty return; }} Return included Point.proceed (); So how can I get the type of return: around?
to return the function type / class from a with this with Try:
signature sign = action joinPoint.getSignature (); Class return type = ((signature of the sign) sign .getReturnType ();
Comments
Post a Comment