Package org.aspectj.weaver.tools
Klasse PointcutParser
java.lang.Object
org.aspectj.weaver.tools.PointcutParser
- Bekannte direkte Unterklassen:
InternalUseOnlyPointcutParser
A PointcutParser can be used to build PointcutExpressions for a user-defined subset of AspectJ's pointcut language
- Autor:
- Adrian Colyer, Andy Clement
-
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotectedCreate a pointcut parser that can parse the full AspectJ pointcut language with the following exceptions: Theif, cflow, and cflowbelowpointcut 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. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected PointcutconcretizePointcutExpression(Pointcut pc, Class<?> inScope, PointcutParameter[] formalParameters) createPointcutParameter(String name, Class<?> type) Create a pointcut parameter of the given name and type.static Set<PointcutPrimitive>static PointcutParserReturns a pointcut parser that can parse the full AspectJ pointcut language with the following exceptions: Theif, cflow, and cflowbelowpointcut 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.static PointcutParsergetPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(ClassLoader classLoader) Returns a pointcut parser that can parse the full AspectJ pointcut language with the following exceptions: Theif, cflow, and cflowbelowpointcut 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.static PointcutParsergetPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(Set<PointcutPrimitive> supportedPointcutKinds) Returns a pointcut parser that can parse pointcut expressions built from a user-defined subset of AspectJ's supported pointcut primitives.static PointcutParsergetPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(Set<PointcutPrimitive> supportedPointcutKinds, ClassLoader classLoader) Returns a pointcut parser that can parse pointcut expressions built from a user-defined subset of AspectJ's supported pointcut primitives.parsePointcutExpression(String expression) Parse the given pointcut expression.parsePointcutExpression(String expression, Class<?> inScope, PointcutParameter[] formalParameters) Parse the given pointcut expression.parseTypePattern(String typePattern) Parse the given aspectj type pattern, and return a matcher that can be used to match types using it.voidregisterPointcutDesignatorHandler(PointcutDesignatorHandler designatorHandler) Register a new pointcut designator handler with this parser.protected PointcutresolvePointcutExpression(String expression, Class<?> inScope, PointcutParameter[] formalParameters) protected voidsetClassLoader(ClassLoader aLoader) Set the classloader that this parser should use for type resolution.protected voidsetClassLoader(ClassLoader aLoader, boolean shareWorlds) Set the classloader that this parser should use for type resolution.voidsetLintProperties(String resourcePath) Set the lint properties for this parser from the given resource on the classpath.voidsetLintProperties(Properties properties) Set the lint properties for this parser from the given properties set.protected voidsetWorld(ReflectionWorld aWorld)
-
Konstruktordetails
-
PointcutParser
protected PointcutParser()Create a pointcut parser that can parse the full AspectJ pointcut language with the following exceptions:- The
if, cflow, and cflowbelowpointcut 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.
- The
-
-
Methodendetails
-
getAllSupportedPointcutPrimitives
- Gibt zurück:
- 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 cflowbelowpointcut 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.
- The
-
getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution
public static PointcutParser getPointcutParserSupportingSpecifiedPrimitivesAndUsingContextClassloaderForResolution(Set<PointcutPrimitive> 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 cflowbelowpointcut 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.
- Parameter:
supportedPointcutKinds- a set of PointcutPrimitives this parser should support- Löst aus:
UnsupportedOperationException- if the set contains if, cflow, or cflow below
- The
-
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 cflowbelowpointcut 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.
- The
-
getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution
public static PointcutParser getPointcutParserSupportingSpecifiedPrimitivesAndUsingSpecifiedClassLoaderForResolution(Set<PointcutPrimitive> 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 cflowbelowpointcut 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.
- Parameter:
supportedPointcutKinds- a set of PointcutPrimitives this parser should support- Löst aus:
UnsupportedOperationException- if the set contains if, cflow, or cflow below
- The
-
setWorld
-
setClassLoader
Set the classloader that this parser should use for type resolution.- Parameter:
aLoader-
-
setClassLoader
Set the classloader that this parser should use for type resolution.- Parameter:
aLoader-shareWorlds- if true then two PointcutParsers operating using the same classloader will share a ReflectionWorld
-
setLintProperties
Set the lint properties for this parser from the given resource on the classpath.- Parameter:
resourcePath- path to a file containing aspectj lint properties- Löst aus:
IOException
-
setLintProperties
Set the lint properties for this parser from the given properties set.- Parameter:
properties-
-
registerPointcutDesignatorHandler
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.- Parameter:
designatorHandler-
-
createPointcutParameter
Create a pointcut parameter of the given name and type.- Parameter:
name-type-- Gibt zurück:
-
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).- Löst aus:
UnsupportedPointcutPrimitiveException- if the parser encounters a primitive pointcut expression of a kind not supported by this PointcutParser.IllegalArgumentException- if the expression is not a well-formed pointcut expression
-
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.- Löst aus:
UnsupportedPointcutPrimitiveException- if the parser encounters a primitive pointcut expression of a kind not supported by this PointcutParser.IllegalArgumentException- if the expression is not a well-formed pointcut expression
-
resolvePointcutExpression
protected Pointcut resolvePointcutExpression(String expression, Class<?> inScope, PointcutParameter[] formalParameters) -
concretizePointcutExpression
protected Pointcut concretizePointcutExpression(Pointcut pc, Class<?> inScope, PointcutParameter[] formalParameters) -
parseTypePattern
Parse the given aspectj type pattern, and return a matcher that can be used to match types using it.- Parameter:
typePattern- an aspectj type pattern- Gibt zurück:
- a type pattern matcher that matches using the given pattern
- Löst aus:
IllegalArgumentException- if the type pattern cannot be successfully parsed.
-