我在周围的 adivce 中切入了 String .hashCode。我想将目标(字符串)更改为大写,然后继续调用原始 hashCode。我不知道该怎么做,下面的代码不能正常工作。
@Pointcut("call(int hashCode(..)) && target(sourceString) && within(com.sample.package..*)")
public void hashCodePointcut(final String sourceString) {}
@Around("hashCodePointcut(sourceString)")
public Object around(final ProceedingJoinPoint joinPoint, String sourceString)
throws Throwable {
System.out.println("<<<<<<<<<<<<<<<<<Invoking hashCode on "+joinPoint.getSourceLocation().getFileName());
System.out.println("<<<<<<<<<<<<<<<<<Target String: "+ sourceString);
sourceString = sourceString.toUpperCase();
return joinPoint.proceed();
}