Top Description Fields Constructors Methods
org.aspectj.weaver.tools

public Class StandardPointcutParser

extends Object
Class Inheritance
Imports
java.io.File, java.util.HashSet, .Properties, .Set, org.aspectj.bridge.IMessageHandler, .ISourceLocation, .SourceLocation, org.aspectj.weaver.BindingScope, .IHasPosition, .ISourceContext, .IntMap, .ResolvedType, .Shadow, .UnresolvedType, .World, org.aspectj.weaver.internal.tools.StandardPointcutExpressionImpl, .TypePatternMatcherImpl, org.aspectj.weaver.patterns.AndPointcut, .CflowPointcut, .FormalBinding, .IScope, .KindedPointcut, .NotPointcut, .OrPointcut, .ParserException, .PatternParser, .Pointcut, .SimpleScope, .ThisOrTargetAnnotationPointcut, .ThisOrTargetPointcut, .TypePattern, org.aspectj.weaver.reflect.PointcutParameterImpl, .ReflectionWorld

A PointcutParser can be used to build PointcutExpressions for a user-defined subset of AspectJ's pointcut language

Field Summary

Modifier and TypeField and Description
private final Set<PointcutDesignatorHandler>
private final Set<PointcutPrimitive>
private World

Constructor Summary

AccessConstructor and Description
protected
StandardPointcutParser(World world)

Create 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.
private
StandardPointcutParser(Set<PointcutPrimitive>
a set of PointcutPrimitives this parser should support
supportedPointcutKinds
,
World world)

Create a pointcut parser that can parse pointcut expressions built from a user-defined subset of AspectJ's supported pointcut primitives.

Method Summary

Modifier and TypeMethod and Description
private IScope
buildResolutionScope(Class<?> inScope, PointcutParameter[] formalParameters)

private String
protected Pointcut
concretizePointcutExpression(Pointcut pc, Class<?> inScope, PointcutParameter[] formalParameters)

public PointcutParameter
createPointcutParameter(String name, Class<T> type)

Create a pointcut parameter of the given name and type.

public static Set<PointcutPrimitive>

Returns:

a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser constructor).
getAllSupportedPointcutPrimitives
()

public static StandardPointcutParser
getPointcutParserSupportingAllPrimitives(World world)

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.
public static StandardPointcutParser
getPointcutParserSupportingSpecifiedPrimitives(Set<E>
a set of PointcutPrimitives this parser should support
supportedPointcutKinds
,
World world)

Returns a pointcut parser that can parse pointcut expressions built from a user-defined subset of AspectJ's supported pointcut primitives.

pack-priv Set<E>
private World
public StandardPointcutExpression
parsePointcutExpression(String expression)

Parse the given pointcut expression.

public StandardPointcutExpression
parsePointcutExpression(String expression, Class<T> inScope, PointcutParameter[] formalParameters)

Parse the given pointcut expression.

public TypePatternMatcher

Returns:

a type pattern matcher that matches using the given pattern
parseTypePattern
(String
an aspectj type pattern
typePattern
)

Parse the given aspectj type pattern, and return a matcher that can be used to match types using it.

public void
registerPointcutDesignatorHandler(PointcutDesignatorHandler designatorHandler)

Register a new pointcut designator handler with this parser.

protected Pointcut
resolvePointcutExpression(String expression, Class<?> inScope, PointcutParameter[] formalParameters)

pack-priv IMessageHandler
public void
setLintProperties(Properties properties)

Set the lint properties for this parser from the given properties set.

private UnresolvedType
private void
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pointcutDesignatorsback to summary
private final Set<PointcutDesignatorHandler> pointcutDesignators
supportedPrimitivesback to summary
private final Set<PointcutPrimitive> supportedPrimitives
worldback to summary
private World world

Constructor Detail

StandardPointcutParserback to summary
protected StandardPointcutParser(World world)

Create 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.
StandardPointcutParserback to summary
private StandardPointcutParser(Set<PointcutPrimitive> supportedPointcutKinds, World world)

Create 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.
Parameters
supportedPointcutKinds:Set<PointcutPrimitive>

a set of PointcutPrimitives this parser should support

Exceptions
UnsupportedOperationException:
if the set contains if, cflow, or cflow below

Method Detail

buildResolutionScopeback to summary
private IScope buildResolutionScope(Class<?> inScope, PointcutParameter[] formalParameters)
buildUserMessageFromParserExceptionback to summary
private String buildUserMessageFromParserException(String pc, ParserException ex)
concretizePointcutExpressionback to summary
protected Pointcut concretizePointcutExpression(Pointcut pc, Class<?> inScope, PointcutParameter[] formalParameters)
createPointcutParameterback to summary
public PointcutParameter createPointcutParameter(String name, Class<T> type)

Create a pointcut parameter of the given name and type.

getAllSupportedPointcutPrimitivesback to summary
public static Set<PointcutPrimitive> getAllSupportedPointcutPrimitives()
Returns:Set<PointcutPrimitive>

a Set containing every PointcutPrimitive except if, cflow, and cflowbelow (useful for passing to PointcutParser constructor).

getPointcutParserSupportingAllPrimitivesback to summary
public static StandardPointcutParser getPointcutParserSupportingAllPrimitives(World world)

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.

getPointcutParserSupportingSpecifiedPrimitivesback to summary
public static StandardPointcutParser getPointcutParserSupportingSpecifiedPrimitives(Set<E> supportedPointcutKinds, World world)

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.

Parameters
supportedPointcutKinds:Set<E>

a set of PointcutPrimitives this parser should support

Exceptions
UnsupportedOperationException:
if the set contains if, cflow, or cflow below
getSupportedPrimitivesback to summary
pack-priv Set<E> getSupportedPrimitives()
getWorldback to summary
private World getWorld()
parsePointcutExpressionback to summary
public StandardPointcutExpression 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).

Exceptions
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
parsePointcutExpressionback to summary
public StandardPointcutExpression parsePointcutExpression(String expression, Class<T> 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.

Exceptions
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
parseTypePatternback to summary
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.

Parameters
typePattern:String

an aspectj type pattern

Returns:TypePatternMatcher

a type pattern matcher that matches using the given pattern

Exceptions
IllegalArgumentException:
if the type pattern cannot be successfully parsed.
registerPointcutDesignatorHandlerback to summary
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.

resolvePointcutExpressionback to summary
protected Pointcut resolvePointcutExpression(String expression, Class<?> inScope, PointcutParameter[] formalParameters)
setCustomMessageHandlerback to summary
pack-priv IMessageHandler setCustomMessageHandler(IMessageHandler aHandler)
setLintPropertiesback to summary
public void setLintProperties(Properties properties)

Set the lint properties for this parser from the given properties set.

toUnresolvedTypeback to summary
private UnresolvedType toUnresolvedType(Class<?> clazz)
validateAgainstSupportedPrimitivesback to summary
private void validateAgainstSupportedPrimitives(Pointcut pc, String expression)
validateKindedPointcutback to summary
private void validateKindedPointcut(KindedPointcut pc, String expression)