org.aspectj.weaver.tools.PointcutParser Java Examples

The following examples show how to use org.aspectj.weaver.tools.PointcutParser. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AspectJExpressionPointcut.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Build the underlying AspectJ pointcut expression.
 */
private PointcutExpression buildPointcutExpression(@Nullable ClassLoader classLoader) {
	PointcutParser parser = initializePointcutParser(classLoader);
	PointcutParameter[] pointcutParameters = new PointcutParameter[this.pointcutParameterNames.length];
	for (int i = 0; i < pointcutParameters.length; i++) {
		pointcutParameters[i] = parser.createPointcutParameter(
				this.pointcutParameterNames[i], this.pointcutParameterTypes[i]);
	}
	return parser.parsePointcutExpression(replaceBooleanOperators(resolveExpression()),
			this.pointcutDeclarationScope, pointcutParameters);
}
 
Example #2
Source File: AspectJExpressionPointcut.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Initialize the underlying AspectJ pointcut parser.
 */
private PointcutParser initializePointcutParser(@Nullable ClassLoader classLoader) {
	PointcutParser parser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(
					SUPPORTED_PRIMITIVES, classLoader);
	parser.registerPointcutDesignatorHandler(new BeanPointcutDesignatorHandler());
	return parser;
}
 
Example #3
Source File: AspectJExpressionPointcut.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Build the underlying AspectJ pointcut expression.
 */
private PointcutExpression buildPointcutExpression(@Nullable ClassLoader classLoader) {
	PointcutParser parser = initializePointcutParser(classLoader);
	PointcutParameter[] pointcutParameters = new PointcutParameter[this.pointcutParameterNames.length];
	for (int i = 0; i < pointcutParameters.length; i++) {
		pointcutParameters[i] = parser.createPointcutParameter(
				this.pointcutParameterNames[i], this.pointcutParameterTypes[i]);
	}
	return parser.parsePointcutExpression(replaceBooleanOperators(resolveExpression()),
			this.pointcutDeclarationScope, pointcutParameters);
}
 
Example #4
Source File: AspectJExpressionPointcut.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Initialize the underlying AspectJ pointcut parser.
 */
private PointcutParser initializePointcutParser(@Nullable ClassLoader classLoader) {
	PointcutParser parser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(
					SUPPORTED_PRIMITIVES, classLoader);
	parser.registerPointcutDesignatorHandler(new BeanPointcutDesignatorHandler());
	return parser;
}
 
Example #5
Source File: ExpressionMatcher.java    From defender with Apache License 2.0 5 votes vote down vote up
@Override
public boolean match(Caller caller, String pattern) {
	if(! pattern.startsWith("execution")) {
		pattern = "execution(" + pattern + ")";
	}
	
	PointcutExpression pe = cache.get(pattern);
	if(pe == null) {
		PointcutParser pp = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution();
		pe = pp.parsePointcutExpression(pattern);
		cache.set(pattern, pe);
	}
	ShadowMatch sm = pe.matchesMethodExecution(caller.getTargetMethod());
	return sm.alwaysMatches();
}
 
Example #6
Source File: AspectJExpressionPointcut.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the underlying AspectJ pointcut parser.
 */
private PointcutParser initializePointcutParser(ClassLoader cl) {
	PointcutParser parser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(
					SUPPORTED_PRIMITIVES, cl);
	parser.registerPointcutDesignatorHandler(new BeanNamePointcutDesignatorHandler());
	return parser;
}
 
Example #7
Source File: AspectJExpressionPointcut.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Build the underlying AspectJ pointcut expression.
 */
private PointcutExpression buildPointcutExpression(ClassLoader classLoader) {
	PointcutParser parser = initializePointcutParser(classLoader);
	PointcutParameter[] pointcutParameters = new PointcutParameter[this.pointcutParameterNames.length];
	for (int i = 0; i < pointcutParameters.length; i++) {
		pointcutParameters[i] = parser.createPointcutParameter(
				this.pointcutParameterNames[i], this.pointcutParameterTypes[i]);
	}
	return parser.parsePointcutExpression(replaceBooleanOperators(getExpression()),
			this.pointcutDeclarationScope, pointcutParameters);
}
 
Example #8
Source File: AspectJExpressionPointcut.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Build the underlying AspectJ pointcut expression.
 */
private PointcutExpression buildPointcutExpression(ClassLoader classLoader) {
	PointcutParser parser = initializePointcutParser(classLoader);
	PointcutParameter[] pointcutParameters = new PointcutParameter[this.pointcutParameterNames.length];
	for (int i = 0; i < pointcutParameters.length; i++) {
		pointcutParameters[i] = parser.createPointcutParameter(
				this.pointcutParameterNames[i], this.pointcutParameterTypes[i]);
	}
	return parser.parsePointcutExpression(replaceBooleanOperators(getExpression()),
			this.pointcutDeclarationScope, pointcutParameters);
}
 
Example #9
Source File: AspectJExpressionPointcut.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initialize the underlying AspectJ pointcut parser.
 */
private PointcutParser initializePointcutParser(ClassLoader cl) {
	PointcutParser parser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(
					SUPPORTED_PRIMITIVES, cl);
	parser.registerPointcutDesignatorHandler(new BeanNamePointcutDesignatorHandler());
	return parser;
}
 
Example #10
Source File: AspectJExpressionPointcut.java    From tiny-spring with Apache License 2.0 4 votes vote down vote up
public AspectJExpressionPointcut(Set<PointcutPrimitive> supportedPrimitives) {
	pointcutParser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(supportedPrimitives);
}
 
Example #11
Source File: AspectJExpressionPointcut.java    From tiny-spring with Apache License 2.0 4 votes vote down vote up
public AspectJExpressionPointcut(Set<PointcutPrimitive> supportedPrimitives) {
	pointcutParser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(supportedPrimitives);
}
 
Example #12
Source File: AspectJExpressionPointcut.java    From tiny-spring with Apache License 2.0 4 votes vote down vote up
public AspectJExpressionPointcut(Set<PointcutPrimitive> supportedPrimitives) {
	pointcutParser = PointcutParser
			.getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(supportedPrimitives);
}
 
Example #13
Source File: AspectJExpressionPointcut.java    From toy-spring with Apache License 2.0 4 votes vote down vote up
public AspectJExpressionPointcut(Set<PointcutPrimitive> supportedPrimitives) {
    pointcutParser = PointcutParser
            .getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(supportedPrimitives);
}
 
Example #14
Source File: ProxyPointcut.java    From doodle with Apache License 2.0 4 votes vote down vote up
public ProxyPointcut(Set<PointcutPrimitive> supportedPrimitives) {
    pointcutParser = PointcutParser
            .getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(supportedPrimitives);
}
 
Example #15
Source File: TypePatternClassFilter.java    From spring4-understanding with Apache License 2.0 3 votes vote down vote up
/**
 * Set the AspectJ type pattern to match.
 * <p>Examples include:
 * <code class="code">
 * org.springframework.beans.*
 * </code>
 * This will match any class or interface in the given package.
 * <code class="code">
 * org.springframework.beans.ITestBean+
 * </code>
 * This will match the {@code ITestBean} interface and any class
 * that implements it.
 * <p>These conventions are established by AspectJ, not Spring AOP.
 * @param typePattern the type pattern that AspectJ weaver should parse
 * @throws IllegalArgumentException if the supplied {@code typePattern} is {@code null}
 * or is recognized as invalid
 */
public void setTypePattern(String typePattern) {
	Assert.notNull(typePattern);
	this.typePattern = typePattern;
	this.aspectJTypePatternMatcher =
			PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution().
			parseTypePattern(replaceBooleanOperators(typePattern));
}
 
Example #16
Source File: TypePatternClassFilter.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Set the AspectJ type pattern to match.
 * <p>Examples include:
 * <code class="code">
 * org.springframework.beans.*
 * </code>
 * This will match any class or interface in the given package.
 * <code class="code">
 * org.springframework.beans.ITestBean+
 * </code>
 * This will match the {@code ITestBean} interface and any class
 * that implements it.
 * <p>These conventions are established by AspectJ, not Spring AOP.
 * @param typePattern the type pattern that AspectJ weaver should parse
 * @throws IllegalArgumentException if the supplied {@code typePattern} is {@code null}
 * or is recognized as invalid
 */
public void setTypePattern(String typePattern) {
	Assert.notNull(typePattern, "Type pattern must not be null");
	this.typePattern = typePattern;
	this.aspectJTypePatternMatcher =
			PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution().
			parseTypePattern(replaceBooleanOperators(typePattern));
}
 
Example #17
Source File: TypePatternClassFilter.java    From java-technology-stack with MIT License 3 votes vote down vote up
/**
 * Set the AspectJ type pattern to match.
 * <p>Examples include:
 * <code class="code">
 * org.springframework.beans.*
 * </code>
 * This will match any class or interface in the given package.
 * <code class="code">
 * org.springframework.beans.ITestBean+
 * </code>
 * This will match the {@code ITestBean} interface and any class
 * that implements it.
 * <p>These conventions are established by AspectJ, not Spring AOP.
 * @param typePattern the type pattern that AspectJ weaver should parse
 */
public void setTypePattern(String typePattern) {
	Assert.notNull(typePattern, "Type pattern must not be null");
	this.typePattern = typePattern;
	this.aspectJTypePatternMatcher =
			PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution().
			parseTypePattern(replaceBooleanOperators(typePattern));
}
 
Example #18
Source File: TypePatternClassFilter.java    From spring-analysis-note with MIT License 3 votes vote down vote up
/**
 * Set the AspectJ type pattern to match.
 * <p>Examples include:
 * <code class="code">
 * org.springframework.beans.*
 * </code>
 * This will match any class or interface in the given package.
 * <code class="code">
 * org.springframework.beans.ITestBean+
 * </code>
 * This will match the {@code ITestBean} interface and any class
 * that implements it.
 * <p>These conventions are established by AspectJ, not Spring AOP.
 * @param typePattern the type pattern that AspectJ weaver should parse
 */
public void setTypePattern(String typePattern) {
	Assert.notNull(typePattern, "Type pattern must not be null");
	this.typePattern = typePattern;
	this.aspectJTypePatternMatcher =
			PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution().
			parseTypePattern(replaceBooleanOperators(typePattern));
}