use of org.aspectj.lang.ProceedingJoinPoint in project spring-framework by spring-projects.
the class MultiplyReturnValue method doubleReturnValue.
@Around("execution(int *.getAge())")
public Object doubleReturnValue(ProceedingJoinPoint pjp) throws Throwable {
++this.invocations;
int result = (Integer) pjp.proceed();
return result * this.multiple;
}
use of org.aspectj.lang.ProceedingJoinPoint in project spring-framework by spring-projects.
the class SimpleSpringBeforeAdvice method aroundAdviceOne.
public int aroundAdviceOne(ProceedingJoinPoint pjp) {
int ret = -1;
this.collaborator.aroundAdviceOne(this.name);
try {
ret = ((Integer) pjp.proceed()).intValue();
} catch (Throwable t) {
throw new RuntimeException(t);
}
this.collaborator.aroundAdviceOne(this.name);
return ret;
}
use of org.aspectj.lang.ProceedingJoinPoint in project T-MVP by north2016.
the class SysPermissionAspect method aroundJoinPoint.
@Around("execution(@com.app.annotation.aspect.Permission * *(..)) && @annotation(permission)")
public void aroundJoinPoint(ProceedingJoinPoint joinPoint, Permission permission) throws Throwable {
AppCompatActivity ac = (AppCompatActivity) App.getAppContext().getCurActivity();
new AlertDialog.Builder(ac).setTitle("提示").setMessage("为了应用可以正常使用,请您点击确认申请权限。").setNegativeButton("取消", null).setPositiveButton("允许", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MPermissionUtils.requestPermissionsResult(ac, 1, permission.value(), new MPermissionUtils.OnPermissionListener() {
@Override
public void onPermissionGranted() {
try {
// 获得权限,执行原方法
joinPoint.proceed();
} catch (Throwable e) {
e.printStackTrace();
}
}
@Override
public void onPermissionDenied() {
MPermissionUtils.showTipsDialog(ac);
}
});
}
}).create().show();
}
use of org.aspectj.lang.ProceedingJoinPoint in project aws-xray-sdk-java by aws.
the class BaseAbstractXRayInterceptor method processXRayTrace.
protected Object processXRayTrace(ProceedingJoinPoint pjp) throws Throwable {
try {
Subsegment subsegment = AWSXRay.beginSubsegment(pjp.getSignature().getName());
if (subsegment != null) {
subsegment.setMetadata(generateMetadata(pjp, subsegment));
}
return XRayInterceptorUtils.conditionalProceed(pjp);
} catch (Exception e) {
AWSXRay.getCurrentSegmentOptional().ifPresent(x -> x.addException(e));
throw e;
} finally {
logger.trace("Ending Subsegment");
AWSXRay.endSubsegment();
}
}
use of org.aspectj.lang.ProceedingJoinPoint in project alfresco-repository by Alfresco.
the class AJExtender method extendAroundAdvice.
/**
* Around advice helper that matches the advised method with its
* corresponding extension method, sets up aspectJ call contexts (egg. the
* local-proceed context) and delegates to the extension method.
*
* @param thisJoinPoint
* @param extensible
* @param extendAnnotation
* @param extension
* @return the result of the extended method
*/
static Object extendAroundAdvice(JoinPoint thisJoinPoint, Extensible extensible, Extend extendAnnotation, Object extension) {
MethodSignature ms = (MethodSignature) thisJoinPoint.getSignature();
Method method = ms.getMethod();
try {
ajLocalProceedingJoinPoints.get().push(new ProceedingContext(extendAnnotation, (ProceedingJoinPoint) thisJoinPoint));
Method extensionMethod = extension.getClass().getMethod(method.getName(), method.getParameterTypes());
if (logger.isDebugEnabled()) {
oneTimeLiveLog(AJExtender.logger, new ExtensionRoute(extendAnnotation, method, extensionMethod));
}
return extensionMethod.invoke(extension, thisJoinPoint.getArgs());
} catch (IllegalAccessException error) {
throw new InvalidExtension("Ivalid extension : " + error.getMessage(), error);
} catch (IllegalArgumentException error) {
throw new InvalidExtension("Ivalid extension : " + error.getMessage(), error);
} catch (InvocationTargetException error) {
Throwable targetException = error.getTargetException();
if (targetException instanceof RuntimeException) {
throw (RuntimeException) targetException;
} else {
throw new ExtensionTargetException(targetException);
}
} catch (NoSuchMethodException error) {
throw new InvalidExtension("Ivalid extension : " + error.getMessage(), error);
} catch (SecurityException error) {
throw new InvalidExtension("Ivalid extension : " + error.getMessage(), error);
} finally {
ajLocalProceedingJoinPoints.get().pop();
}
}
Aggregations