aop java proceed,Java ProceedingJoinPoint.proceed方法代碼示例

本文整理匯總了Java中org.aspectj.lang.ProceedingJoinPoint.proceed方法的典型用法代碼示例。如果您正苦於以下問題:Java ProceedingJoinPoint.proceed方法的具體用法?Java ProceedingJoinPoint.proceed怎麽用?Java ProceedingJoinPoint.proceed使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.aspectj.lang.ProceedingJoinPoint的用法示例。

在下文中一共展示了ProceedingJoinPoint.proceed方法的20個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。

示例1: aroundAdvise

​點讚 5

import org.aspectj.lang.ProceedingJoinPoint; //導入方法依賴的package包/類

public int aroundAdvise(ProceedingJoinPoint joinPoint) {

long start_time=System.currentTimeMillis();

logger.info("around advise before "+joinPoint.getSignature()

+" B.L.method getting invoked");

Integer o=null;

try {

o=(Integer)joinPoint.proceed();

logger.info("number of rows affected:-"+o);

} catch (Throwable e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

logger.info("around advise after "+joinPoint.getSignature()+

" B.L.method getting invoked");

long end_time=System.currentTimeMillis();

logger.info(joinPoint.getSignature()+" took " +

(end_time-start_time)+" to complete");

return o.intValue();

}

開發者ID:PacktPublishing,項目名稱:Learning-Spring-5.0,代碼行數:23,

示例2: constructorAnnotatedTrace

​點讚 3

import org.aspectj.lang.ProceedingJoinPoint; //導入方法依賴的package包/類

@Around("methodAnnotatedWithTrace() || constructorAnnotatedTrace()")

public Object traceMethod(final ProceedingJoinPoint joinPoint) throws Throwable {

MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();

Trace trace = methodSignature.getMethod().getAnnotation(Trace.class);

if (trace!=null && !trace.enable()) {

return joinPoint.proceed();

}

String className = methodSignature.getDeclaringType().getSimpleName();

String methodName = methodSignature.getName();

final StopWatch stopWatch = new StopWatch();

stopWatch.start();

Object result = joinPoint.proceed();

stopWatch.stop();

if (Preconditions.isBlank(className)) {

className = "Anonymous class";

}

L.i(className, buildLogMessage(methodName, stopWatch.getElapsedTime()));

return result;

}

開發者ID:fengzhizi715,項目名稱:SAF-AOP,代碼行數:25,

示例3: executeWithoutPostProcessor

​點讚 3

import org.aspectj.lang.ProceedingJoinPoint; //導入方法依賴的package包/類

private Object executeWithoutPostProcessor(

ProceedingJoinPoint call, ArgumentDiscover argumentDiscover) throws Throwable {

final Object[] args = call.getArgs();

final Message message = argumentDiscover.message;

final String exchange = argumentDiscover.exchangeOfSender;

final String routingKey = argumentDiscover.routingKey;

before(message, exchange, routingKey);

try {

Object result = call.proceed(args);

spanManager.afterSend(null);

return result;

} catch (Exception e) {

spanManager.afterSend(e);

throw e;

}

}

開發者ID:netshoes,項目名稱:spring-cloud-sleuth-amqp,代碼行數:17,

示例4: returnValueHandle

​點讚 3

import org.aspectj.lang.ProceedingJoinPoint; //導入方法依賴的package包/類

@Around( "execution(org.springframework.http.ResponseEntity com.aidijing.*.controller.*Controller.*(..)) )" )

public Object returnValueHandle ( ProceedingJoinPoint joinPoint ) throws Throwable {

Object returnValue = joinPoint.proceed();

ResponseEntity responseEntity = ( ResponseEntity ) returnValue;

// 用戶權限或者用戶自定義處理

final RolePermissionResource currentRequestRolePermissionResource = ContextUtils.getCurrentRequestRolePermissionResource();

if ( Objects.isNull( currentRequestRolePermissionResource ) ) {

return returnValue;

}

if ( ResponseEntityPro.WILDCARD_ALL.equals( currentRequestRolePermissionResource.getResourceApiUriShowFields() ) ) {

ContextUtils.removeCurrentRequestRolePermissionResource();

return returnValue;

}

final String resourceApiUriShowFields = currentRequestRolePermissionResource.getResource

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值