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


Java Pointcut.TRUE属性代码示例

本文整理汇总了Java中org.springframework.aop.Pointcut.TRUE属性的典型用法代码示例。如果您正苦于以下问题:Java Pointcut.TRUE属性的具体用法?Java Pointcut.TRUE怎么用?Java Pointcut.TRUE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.springframework.aop.Pointcut的用法示例。


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

示例1: matches

/**
 * Perform the least expensive check for a pointcut match.
 * @param pointcut the pointcut to match
 * @param method the candidate method
 * @param targetClass the target class
 * @param args arguments to the method
 * @return whether there's a runtime match
 */
public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object[] args) {
	Assert.notNull(pointcut, "Pointcut must not be null");
	if (pointcut == Pointcut.TRUE) {
		return true;
	}
	if (pointcut.getClassFilter().matches(targetClass)) {
		// Only check if it gets past first hurdle.
		MethodMatcher mm = pointcut.getMethodMatcher();
		if (mm.matches(method, targetClass)) {
			// We may need additional runtime (argument) check.
			return (!mm.isRuntime() || mm.matches(method, targetClass, args));
		}
	}
	return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:Pointcuts.java

示例2: matches

/**
 * Perform the least expensive check for a pointcut match.
 * @param pointcut the pointcut to match
 * @param method the candidate method
 * @param targetClass the target class
 * @param args arguments to the method
 * @return whether there's a runtime match
 */
public static boolean matches(Pointcut pointcut, Method method, Class<?> targetClass, Object... args) {
	Assert.notNull(pointcut, "Pointcut must not be null");
	if (pointcut == Pointcut.TRUE) {
		return true;
	}
	if (pointcut.getClassFilter().matches(targetClass)) {
		// Only check if it gets past first hurdle.
		MethodMatcher mm = pointcut.getMethodMatcher();
		if (mm.matches(method, targetClass)) {
			// We may need additional runtime (argument) check.
			return (!mm.isRuntime() || mm.matches(method, targetClass, args));
		}
	}
	return false;
}
 
开发者ID:txazo,项目名称:spring,代码行数:23,代码来源:Pointcuts.java

示例3: matches

/**
 * Perform the least expensive check for a pointcut match.
 * @param pointcut the pointcut to match
 * @param method the candidate method
 * @param targetClass the target class
 * @param args arguments to the method
 * @return whether there's a runtime match
 */
public static boolean matches(Pointcut pointcut, Method method, Class targetClass, Object[] args) {
	Assert.notNull(pointcut, "Pointcut must not be null");
	if (pointcut == Pointcut.TRUE) {
		return true;
	}
	if (pointcut.getClassFilter().matches(targetClass)) {
		// Only check if it gets past first hurdle.
		MethodMatcher mm = pointcut.getMethodMatcher();
		if (mm.matches(method, targetClass)) {
			// We may need additional runtime (argument) check.
			return (!mm.isRuntime() || mm.matches(method, targetClass, args));
		}
	}
	return false;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:23,代码来源:Pointcuts.java

示例4: AspectMetadata

/**
 * 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,代码行数:45,代码来源:AspectMetadata.java

示例5: AspectMetadata

/**
 * 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,代码行数:45,代码来源:AspectMetadata.java

示例6: AspectMetadata

/**
 * 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,代码行数:46,代码来源:AspectMetadata.java

示例7: AspectMetadata

/**
 * 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,代码行数:45,代码来源:AspectMetadata.java

示例8: DefaultPointcutAdvisor

/**
 * Create a DefaultPointcutAdvisor that matches all methods.
 * <p>{@code Pointcut.TRUE} will be used as Pointcut.
 * @param advice the Advice to use
 */
public DefaultPointcutAdvisor(Advice advice) {
	this(Pointcut.TRUE, advice);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:DefaultPointcutAdvisor.java

示例9: setPointcut

/**
 * Specify the pointcut targeting the advice.
 * <p>Default is {@code Pointcut.TRUE}.
 * @see #setAdvice
 */
public void setPointcut(Pointcut pointcut) {
	this.pointcut = (pointcut != null ? pointcut : Pointcut.TRUE);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:DefaultPointcutAdvisor.java

示例10: setPointcut

/**
 * Specify the pointcut targeting the advice.
 * <p>Default is {@code Pointcut.TRUE}.
 * @see #setAdviceBeanName
 */
public void setPointcut(Pointcut pointcut) {
	this.pointcut = (pointcut != null ? pointcut : Pointcut.TRUE);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:8,代码来源:DefaultBeanFactoryPointcutAdvisor.java


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