A PointcutParser can be used to build PointcutExpressions for a
user-defined subset of AspectJ's pointcut language
concretizePointcutExpression
protected org.aspectj.weaver.patterns.Pointcut concretizePointcutExpression(org.aspectj.weaver.patterns.Pointcut pc,
Class inScope,
PointcutParameter[] formalParameters)
createPointcutParameter
public PointcutParameter createPointcutParameter(String name,
Class type)
Create a pointcut parameter of the given name and type.
getAllSupportedPointcutPrimitives
public static Set getAllSupportedPointcutPrimitives()
- a Set containing every PointcutPrimitive except
if, cflow, and cflowbelow (useful for passing to
PointcutParser constructor).
getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution
public static PointcutParser getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution()
Returns a pointcut parser that can parse the full AspectJ pointcut
language with the following exceptions:
- The
if, cflow, and cflowbelow
pointcut designators are not supported
- Pointcut expressions must be self-contained :- they cannot contain references
to other named pointcuts
- The pointcut expression must be anonymous with no formals allowed.
When resolving types in pointcut expressions, the context classloader is used to find types.
getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution
public static PointcutParser getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(ClassLoader classLoader)
Returns a pointcut parser that can parse the full AspectJ pointcut
language with the following exceptions:
- The
if, cflow, and cflowbelow
pointcut designators are not supported
- Pointcut expressions must be self-contained :- they cannot contain references
to other named pointcuts
- The pointcut expression must be anonymous with no formals allowed.
When resolving types in pointcut expressions, the given classloader is used to find types.
getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution
public static PointcutParser getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(Set supportedPointcutKinds)
Returns a pointcut parser that can parse pointcut expressions built
from a user-defined subset of AspectJ's supported pointcut primitives.
The following restrictions apply:
- The
if, cflow, and cflowbelow
pointcut designators are not supported
- Pointcut expressions must be self-contained :- they cannot contain references
to other named pointcuts
- The pointcut expression must be anonymous with no formals allowed.
When resolving types in pointcut expressions, the context classloader is used to find types.
supportedPointcutKinds
- a set of PointcutPrimitives this parser
should support
getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution
public static PointcutParser getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(Set supportedPointcutKinds,
ClassLoader classLoader)
Returns a pointcut parser that can parse pointcut expressions built
from a user-defined subset of AspectJ's supported pointcut primitives.
The following restrictions apply:
- The
if, cflow, and cflowbelow
pointcut designators are not supported
- Pointcut expressions must be self-contained :- they cannot contain references
to other named pointcuts
- The pointcut expression must be anonymous with no formals allowed.
When resolving types in pointcut expressions, the given classloader is used to find types.
supportedPointcutKinds
- a set of PointcutPrimitives this parser
should support
parsePointcutExpression
public PointcutExpression parsePointcutExpression(String expression)
throws UnsupportedPointcutPrimitiveException,
IllegalArgumentException
Parse the given pointcut expression.
A global scope is assumed for resolving any type references, and the pointcut
must contain no formals (variables to be bound).
parsePointcutExpression
public PointcutExpression parsePointcutExpression(String expression,
Class inScope,
PointcutParameter[] formalParameters)
throws UnsupportedPointcutPrimitiveException,
IllegalArgumentException
Parse the given pointcut expression.
The pointcut is resolved as if it had been declared inside the inScope class
(this allows the pointcut to contain unqualified references to other pointcuts
declared in the same type for example).
The pointcut may contain zero or more formal parameters to be bound at matched
join points.
parseTypePattern
public TypePatternMatcher parseTypePattern(String typePattern)
throws IllegalArgumentException
Parse the given aspectj type pattern, and return a
matcher that can be used to match types using it.
typePattern
- an aspectj type pattern
- a type pattern matcher that matches using the given
pattern
registerPointcutDesignatorHandler
public void registerPointcutDesignatorHandler(PointcutDesignatorHandler designatorHandler)
Register a new pointcut designator handler with this parser.
This provides an extension mechansim for the integration of
domain-specific pointcut designators with the AspectJ
pointcut language.
resolvePointcutExpression
protected org.aspectj.weaver.patterns.Pointcut resolvePointcutExpression(String expression,
Class inScope,
PointcutParameter[] formalParameters)
setClassLoader
protected void setClassLoader(ClassLoader aLoader)
Set the classloader that this parser should use for
type resolution.
setLintProperties
public void setLintProperties(Properties properties)
Set the lint properties for this parser from the
given properties set.
setLintProperties
public void setLintProperties(String resourcePath)
throws IOException
Set the lint properties for this parser from the
given resource on the classpath.
resourcePath
- path to a file containing aspectj
lint properties
setWorld
protected void setWorld(org.aspectj.weaver.reflect.ReflectionWorld aWorld)