当前位置: 首页>>代码示例>>Java>>正文


Java ComposablePointcut类代码示例

本文整理汇总了Java中org.springframework.aop.support.ComposablePointcut的典型用法代码示例。如果您正苦于以下问题:Java ComposablePointcut类的具体用法?Java ComposablePointcut怎么用?Java ComposablePointcut使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ComposablePointcut类属于org.springframework.aop.support包,在下文中一共展示了ComposablePointcut类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: packageTraceAdvisor

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
@Bean
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
public Advisor packageTraceAdvisor() {
    ComposablePointcut resultPointcut = new ComposablePointcut();
    {
        List<String> basePackages = findBasePackages();
        String pointcutExpression = makeExpression(basePackages);
        AspectJExpressionPointcut packagePointcut = new AspectJExpressionPointcut();
        log.info("Include package Pointcut expression : {}", pointcutExpression);
        packagePointcut.setExpression(pointcutExpression);
        resultPointcut.intersection((Pointcut) packagePointcut);
    }

    String excludeAnnotation = buildExcludeAnnotation();
    log.info("Exclude Annotation Pointcut expression : {}", excludeAnnotation);

    AspectJExpressionPointcut basePointcut = new AspectJExpressionPointcut();
    basePointcut.setExpression(excludeAnnotation);
    resultPointcut.intersection((Pointcut) basePointcut);

    DefaultPointcutAdvisor pointcutAdvisor = new DefaultPointcutAdvisor(resultPointcut, new TraceAopInterceptor(traceLogManager));
    pointcutAdvisor.setOrder(Integer.MAX_VALUE);
    return pointcutAdvisor;
}
 
开发者ID:acupple,项目名称:stormv-spring-tracer,代码行数:25,代码来源:SimpleTraceConfiguration.java

示例2: buildPointcut

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
/**
 * Calculate a pointcut for the given async annotation types, if any.
 * @param asyncAnnotationTypes the async annotation types to introspect
 * @return the applicable Pointcut object, or {@code null} if none
 */
protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes) {
	ComposablePointcut result = null;
	for (Class<? extends Annotation> asyncAnnotationType : asyncAnnotationTypes) {
		Pointcut cpc = new AnnotationMatchingPointcut(asyncAnnotationType, true);
		Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(asyncAnnotationType);
		if (result == null) {
			result = new ComposablePointcut(cpc).union(mpc);
		}
		else {
			result.union(cpc).union(mpc);
		}
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:AsyncAnnotationAdvisor.java

示例3: buildSafePointcut

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
/**
 * Build a 'safe' pointcut that excludes the AspectJ advice method itself.
 * @return a composable pointcut that builds on the original AspectJ expression pointcut
 * @see #getPointcut()
 */
public final Pointcut buildSafePointcut() {
	Pointcut pc = getPointcut();
	MethodMatcher safeMethodMatcher = MethodMatchers.intersection(
			new AdviceExcludingMethodMatcher(this.aspectJAdviceMethod), pc.getMethodMatcher());
	return new ComposablePointcut(pc.getClassFilter(), safeMethodMatcher);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:AbstractAspectJAdvice.java

示例4: AspectMetadata

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
/**
 * Create a new AspectMetadata instance for the given aspect class.
 * @param aspectClass the aspect class
 * @param aspectName the name of the aspect
 */
public AspectMetadata(Class<?> aspectClass, String aspectName) {
	this.aspectName = aspectName;

	Class<?> currClass = aspectClass;
	AjType<?> ajType = null;
	while (!currClass.equals(Object.class)) {
		AjType<?> ajTypeToCheck = AjTypeSystem.getAjType(currClass);
		if (ajTypeToCheck.isAspect()) {
			ajType = ajTypeToCheck;
			break;
		}
		currClass = currClass.getSuperclass();
	}
	if (ajType == null) {
		throw new IllegalArgumentException("Class '" + aspectClass.getName() + "' is not an @AspectJ aspect");
	}
	this.ajType = ajType;
	if (this.ajType.getDeclarePrecedence().length > 0) {
		throw new IllegalArgumentException("DeclarePrecendence not presently supported in Spring AOP");
	}

	switch (this.ajType.getPerClause().getKind()) {
		case SINGLETON :
			this.perClausePointcut = Pointcut.TRUE;
			return;
		case PERTARGET : case PERTHIS :
			AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
			ajexp.setLocation("@Aspect annotation on " + aspectClass.getName());
			ajexp.setExpression(findPerClause(aspectClass));
			this.perClausePointcut = ajexp;
			return;
		case PERTYPEWITHIN :
			// Works with a type pattern
			this.perClausePointcut = new ComposablePointcut(new TypePatternClassFilter(findPerClause(aspectClass)));
			return;
		default :
			throw new AopConfigException(
					"PerClause " + ajType.getPerClause().getKind() + " not supported by Spring AOP for " + aspectClass);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:46,代码来源:AspectMetadata.java

示例5: AspectMetadata

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
/**
 * Create a new AspectMetadata instance for the given aspect class.
 * @param aspectClass the aspect class
 * @param aspectName the name of the aspect
 */
public AspectMetadata(Class<?> aspectClass, String aspectName) {
	this.aspectName = aspectName;

	Class<?> currClass = aspectClass;
	AjType<?> ajType = null;
	while (currClass != Object.class) {
		AjType<?> ajTypeToCheck = AjTypeSystem.getAjType(currClass);
		if (ajTypeToCheck.isAspect()) {
			ajType = ajTypeToCheck;
			break;
		}
		currClass = currClass.getSuperclass();
	}
	if (ajType == null) {
		throw new IllegalArgumentException("Class '" + aspectClass.getName() + "' is not an @AspectJ aspect");
	}
	this.ajType = ajType;
	if (this.ajType.getDeclarePrecedence().length > 0) {
		throw new IllegalArgumentException("DeclarePrecendence not presently supported in Spring AOP");
	}

	switch (this.ajType.getPerClause().getKind()) {
		case SINGLETON :
			this.perClausePointcut = Pointcut.TRUE;
			return;
		case PERTARGET : case PERTHIS :
			AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
			ajexp.setLocation("@Aspect annotation on " + aspectClass.getName());
			ajexp.setExpression(findPerClause(aspectClass));
			this.perClausePointcut = ajexp;
			return;
		case PERTYPEWITHIN :
			// Works with a type pattern
			this.perClausePointcut = new ComposablePointcut(new TypePatternClassFilter(findPerClause(aspectClass)));
			return;
		default :
			throw new AopConfigException(
					"PerClause " + ajType.getPerClause().getKind() + " not supported by Spring AOP for " + aspectClass);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:46,代码来源:AspectMetadata.java

示例6: AspectMetadata

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
/**
 * Create a new AspectMetadata instance for the given aspect class.
 * @param aspectClass the aspect class
 * @param aspectName the name of the aspect
 */
public AspectMetadata(Class<?> aspectClass, String aspectName) {
	this.aspectName = aspectName;

	Class<?> currClass = aspectClass;
	AjType<?> ajType = null;
	while (currClass != Object.class) {
		AjType<?> ajTypeToCheck = AjTypeSystem.getAjType(currClass);
		if (ajTypeToCheck.isAspect()) {
			ajType = ajTypeToCheck;
			break;
		}
		currClass = currClass.getSuperclass();
	}
	if (ajType == null) {
		throw new IllegalArgumentException("Class '" + aspectClass.getName() + "' is not an @AspectJ aspect");
	}
	if (ajType.getDeclarePrecedence().length > 0) {
		throw new IllegalArgumentException("DeclarePrecendence not presently supported in Spring AOP");
	}
	this.aspectClass = ajType.getJavaClass();
	this.ajType = ajType;

	switch (this.ajType.getPerClause().getKind()) {
		case SINGLETON :
			this.perClausePointcut = Pointcut.TRUE;
			return;
		case PERTARGET : case PERTHIS :
			AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
			ajexp.setLocation("@Aspect annotation on " + aspectClass.getName());
			ajexp.setExpression(findPerClause(aspectClass));
			this.perClausePointcut = ajexp;
			return;
		case PERTYPEWITHIN :
			// Works with a type pattern
			this.perClausePointcut = new ComposablePointcut(new TypePatternClassFilter(findPerClause(aspectClass)));
			return;
		default :
			throw new AopConfigException(
					"PerClause " + ajType.getPerClause().getKind() + " not supported by Spring AOP for " + aspectClass);
	}
}
 
开发者ID:txazo,项目名称:spring,代码行数:47,代码来源:AspectMetadata.java

示例7: addMethodAdvice

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
public <U> SdcctProxyBuilder<T> addMethodAdvice(@Nullable ClassFilter classFilter, @Nullable MethodMatcher methodMatcher,
    SdcctMethodInterceptor<U> advice) {
    return this.addMethodAdvice(new ComposablePointcut(((classFilter != null) ? classFilter : ClassFilter.TRUE), ((methodMatcher != null)
        ? methodMatcher : MethodMatcher.TRUE)), advice);
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:6,代码来源:SdcctAopUtils.java

示例8: LockingAdvisor

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
public LockingAdvisor() {
    super(new ComposablePointcut(new LockingMethodMatcher()), new LockingAdvice());
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:4,代码来源:LockingAdvisor.java

示例9: AspectMetadata

import org.springframework.aop.support.ComposablePointcut; //导入依赖的package包/类
/**
 * Create a new AspectMetadata instance for the given aspect class.
 * @param aspectClass the aspect class
 * @param aspectName the name of the aspect
 */
public AspectMetadata(Class<?> aspectClass, String aspectName) {
	this.aspectName = aspectName;

	Class<?> currClass = aspectClass;
	AjType ajType = null;
	while (!currClass.equals(Object.class)) {
		AjType ajTypeToCheck = AjTypeSystem.getAjType(currClass);
		if (ajTypeToCheck.isAspect()) {
			ajType = ajTypeToCheck;
			break;
		}
		currClass = currClass.getSuperclass();
	}
	if (ajType == null) {
		throw new IllegalArgumentException("Class '" + aspectClass.getName() + "' is not an @AspectJ aspect");
	}
	this.ajType = ajType;
	if (this.ajType.getDeclarePrecedence().length > 0) {
		throw new IllegalArgumentException("DeclarePrecendence not presently supported in Spring AOP");
	}

	switch (this.ajType.getPerClause().getKind()) {
		case SINGLETON :
			this.perClausePointcut = Pointcut.TRUE;
			return;
		case PERTARGET : case PERTHIS :
			AspectJExpressionPointcut ajexp = new AspectJExpressionPointcut();
			ajexp.setLocation("@Aspect annotation on " + aspectClass.getName());
			ajexp.setExpression(findPerClause(aspectClass));
			this.perClausePointcut = ajexp;
			return;
		case PERTYPEWITHIN :
			// Works with a type pattern
			this.perClausePointcut = new ComposablePointcut(new TypePatternClassFilter(findPerClause(aspectClass)));
			return;
		default :
			throw new AopConfigException(
					"PerClause " + ajType.getPerClause().getKind() + " not supported by Spring AOP for " + aspectClass);
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:46,代码来源:AspectMetadata.java


注:本文中的org.springframework.aop.support.ComposablePointcut类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。