当前位置: 首页>>代码示例>>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;未经允许,请勿转载。