當前位置: 首頁>>代碼示例>>Java>>正文


Java After類代碼示例

本文整理匯總了Java中org.aspectj.lang.annotation.After的典型用法代碼示例。如果您正苦於以下問題:Java After類的具體用法?Java After怎麽用?Java After使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


After類屬於org.aspectj.lang.annotation包,在下文中一共展示了After類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loggingAdvice

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("allAppMethodswithin()")
// Try allAppMethodswithin
public void loggingAdvice(JoinPoint jp) {
	
	System.out.println("JoinPoint  -> " + jp.toString());
	
	System.out.println("Target  -> " + jp.getTarget());
	
	if (jp.getTarget() instanceof StatementService) {
		System.out
				.println("logging code inserted after StatementService method execution");
	} else if (jp.getTarget() instanceof PaymentService) {
		System.out
				.println("logging code inserted after PaymentService method execution");
	}

}
 
開發者ID:Illusionist80,項目名稱:SpringTutorial,代碼行數:18,代碼來源:LoggingAdvice.java

示例2: doAfter

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("controllerAspect()")
	public void doAfter(JoinPoint joinPoint) {

		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
		// 讀取session中的用戶
//		User user = SessionUtils.getUserFromSession(request);
		
//		if(null == user){
//			logger.info("未登錄日誌不記錄");
//			return;
//		}
		
		try {
			Object[] args = getLogMethodDescription(joinPoint);
			// *========數據庫日誌=========*//
//			logService.saveLog(user.getId(), user.getAccount(), Integer.valueOf(args[1].toString()),
//                    IpUtils.getIpAddr(request), args[0].toString(),
//                    user.getManufacturerId(), reqDescription(request));

		} catch (Exception e) {
			logger.error(e);
			e.printStackTrace();
		}
	}
 
開發者ID:javahongxi,項目名稱:whatsmars,代碼行數:25,代碼來源:SystemLogAspect.java

示例3: afterMethod

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("execution(* *..web..*Controller.*(..))")
// 在方法執行之後執行的代碼. 無論該方法是否出現異常
public void afterMethod(JoinPoint jp) {		
	Signature signature = jp.getSignature();
	MethodSignature methodSignature = (MethodSignature) signature;
	Method targetMethod = methodSignature.getMethod();
	//Class<? extends Method> clazz = targetMethod.getClass(); 
	if(record){
		if(targetMethod.getAnnotation(LogAudit.class) != null){
			saveOperateLog(targetMethod);
		}
		else if(baseControllerMethodNames.contains(targetMethod.getName())){
			Method parentMethod = baseControllerMethods.get(targetMethod.getName());
			if(parentMethod.getAnnotation(LogAudit.class) != null){
				saveOperateLog(targetMethod);
			}
		}
	}
}
 
開發者ID:simbest,項目名稱:simbest-cores,代碼行數:20,代碼來源:SysOperateInfoAspect.java

示例4: dismissDialog

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
/**
 * 關閉對話框
 *
 * @param joinPoint
 * @throws IllegalAccessException
 */
@After("execution(@zilla.libcore.ui.SupportMethodLoading * *(..))")
public void dismissDialog(ProceedingJoinPoint joinPoint) {
    try {
        Object container = joinPoint.getTarget();

        Field[] fields = container.getClass().getFields();
        for (Field field : fields) {
            if (field.getAnnotation(LifeCircleInject.class) != null) {
                if (IDialog.class.isAssignableFrom(field.getType())) {
                    IDialog iDialog = (IDialog) field.get(container);
                    iDialog.dismiss();
                    return;
                }
            }
        }
    } catch (Exception e) {
        Log.e(e.getMessage());
    }
}
 
開發者ID:zillachan,項目名稱:LibZilla,代碼行數:26,代碼來源:ASupportLoading.java

示例5: afterStop

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
/**
 * When a verticle will be stopped the stop() method will be executed.
 * In this case check if there is a running spring context, if so close it.
 * @param joinPoint the verticle stop method
 */
@After(value = "execution(* io.vertx.core.Verticle+.stop())")
public void afterStop(JoinPoint joinPoint) {
    final Object target = joinPoint.getTarget();
    log.debug("Stop invoked - Terminating spring context for verticle");
    if (target.getClass().isAnnotationPresent(SpringVerticle.class)) {
        if (AnnotationConfigApplicationContext.class.isAssignableFrom(context.getClass())) {
            final ApplicationContext parent = AnnotationConfigApplicationContext.class.cast(context).getParent();
            if (parent == null) {
                AnnotationConfigApplicationContext.class.cast(context).stop();
            } else {
                if (GenericApplicationContext.class.isAssignableFrom(parent.getClass())) {
                    GenericApplicationContext.class.cast(parent).stop();
                }
            }
        }
    }

}
 
開發者ID:amoAHCP,項目名稱:spring-vertx-ext,代碼行數:24,代碼來源:VertxLifecycleAspect.java

示例6: after

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
/**
 * Catch instantiation and validate class.
 *
 * <p>Try NOT to change the signature of this method, in order to keep
 * it backward compatible.
 * @param point Joint point
 */
@After("initialization((@com.jcabi.aspects.Immutable *).new(..))")
public void after(final JoinPoint point) {
    final Class<?> type = point.getTarget().getClass();
    try {
        this.check(type);
    } catch (final ImmutabilityChecker.Violation ex) {
        throw new IllegalStateException(
            String.format(
                // @checkstyle LineLength (1 line)
                "%s is not immutable, can't use it (jcabi-aspects %s/%s)",
                type,
                Version.CURRENT.projectVersion(),
                Version.CURRENT.buildNumber()
            ),
            ex
        );
    }
}
 
開發者ID:jcabi,項目名稱:jcabi-aspects,代碼行數:26,代碼來源:ImmutabilityChecker.java

示例7: afterIfNeeded

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("method()")
public void afterIfNeeded(JoinPoint jPoint) throws Throwable {
    String[] pair = parseNamespaceAndMethodName(jPoint);
    String namespace = pair[0];
    String function = pair[1];

    //invoke after function
    MasterFinder.getInstance().findAndInvoke(namespace, AFTER, function, jPoint.getThis(), jPoint.getArgs());
}
 
開發者ID:TangXiaoLv,項目名稱:Surgeon,代碼行數:10,代碼來源:ReplaceAbleAspect.java

示例8: addListener

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("execution(org.junit.runner.notification.RunNotifier.new())")
public void addListener(final JoinPoint point) {
    final RunNotifier notifier = (RunNotifier) point.getThis();
    notifier.removeListener(allure);
    notifier.addListener(allure);
}
 
開發者ID:allure-framework,項目名稱:allure-java,代碼行數:7,代碼來源:AllureJunit4ListenerAspect.java

示例9: checkStart

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
/**
 * 判斷玩家準備是否要開始遊戲
 *
 * @param point 切點
 */
@After(value = "execution(* telemarketer.skittlealley.model.game.drawguess.DrawGuessContext.addPlayer(..))",
        argNames = "point")
public void checkStart(JoinPoint point) {
    DrawGuessContext ctx = (DrawGuessContext) point.getTarget();
    service.checkStart(ctx);
}
 
開發者ID:csdbianhua,項目名稱:telemarket-skittle-alley,代碼行數:12,代碼來源:DrawGuessAspect.java

示例10: findAspectJAnnotationOnMethod

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
/**
 * Find and return the first AspectJ annotation on the given method
 * (there <i>should</i> only be one anyway...)
 */
@SuppressWarnings("unchecked")
protected static AspectJAnnotation<?> findAspectJAnnotationOnMethod(Method method) {
	Class<?>[] classesToLookFor = new Class<?>[] {
			Before.class, Around.class, After.class, AfterReturning.class, AfterThrowing.class, Pointcut.class};
	for (Class<?> c : classesToLookFor) {
		AspectJAnnotation<?> foundAnnotation = findAnnotation(method, (Class<Annotation>) c);
		if (foundAnnotation != null) {
			return foundAnnotation;
		}
	}
	return null;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:17,代碼來源:AbstractAspectJAdvisorFactory.java

示例11: logAfter

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("pointcut()")
public void logAfter(JoinPoint joinPoint) {
	System.out.println("******");
	System.out.println("logAfter() is running!");
	System.out.println("hijacked : " + joinPoint.getSignature().getName());
	System.out.println("******");
}
 
開發者ID:lf23617358,項目名稱:training-sample,代碼行數:8,代碼來源:LogAspect.java

示例12: onViewCreatedProcess

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("onViewCreated()")
public void onViewCreatedProcess(JoinPoint joinPoint) throws Throwable {
  Object puppet = joinPoint.getTarget();
  //Only inject the class that marked by Puppet annotation.
  Object[] args = joinPoint.getArgs();

  Method onCreate = getRiggerMethod("onViewCreated", Object.class, View.class, Bundle.class);
  onCreate.invoke(getRiggerInstance(), puppet, args[0], args[1]);
}
 
開發者ID:JustKiddingBaby,項目名稱:FragmentRigger,代碼行數:10,代碼來源:FragmentInjection.java

示例13: after

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("annotationPointCut()") //④
public void after(JoinPoint joinPoint) {
    MethodSignature signature = (MethodSignature) joinPoint.getSignature();
    Method method = signature.getMethod();
    Action action = method.getAnnotation(Action.class); 
    System.out.println("注解式攔截 " + action.name()); //⑤
}
 
開發者ID:longjiazuo,項目名稱:spring4.x-project,代碼行數:8,代碼來源:LogAspect.java

示例14: after

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("annotationPointCut()")
public void after(JoinPoint joinpoint) {
	MethodSignature signature = (MethodSignature) joinpoint.getSignature();
	Method method = signature.getMethod();
	Action action = method.getAnnotation(Action.class);
	System.out.println("注解式攔截 " + action.name());
}
 
開發者ID:zhazhapan,項目名稱:hello-spring,代碼行數:8,代碼來源:LogAspect.java

示例15: args

import org.aspectj.lang.annotation.After; //導入依賴的package包/類
@After("@annotation(PreAcquireNamespaceLock) && args(itemId, operator, ..)")
public void requireLockAdvice(long itemId, String operator) {
  Item item = itemService.findOne(itemId);
  if (item == null) {
    throw new BadRequestException("item not exist.");
  }
  tryUnlock(namespaceService.findOne(item.getNamespaceId()));
}
 
開發者ID:dewey-its,項目名稱:apollo-custom,代碼行數:9,代碼來源:NamespaceUnlockAspect.java


注:本文中的org.aspectj.lang.annotation.After類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。