Top Fields Constructors Methods
org.aspectj.weaver.patterns

public Class PatternParser

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashMap, .List, .Map, .Set, org.aspectj.weaver.ISourceContext, .Member, .MemberKind, .Shadow, .UnresolvedType, .World, org.aspectj.weaver.internal.tools.PointcutDesignatorHandlerBasedPointcut, org.aspectj.weaver.tools.ContextBasedMatcher, .PointcutDesignatorHandler

Authors
PARC, Adrian Colyer, Andy Clement

Field Summary

Modifier and TypeField and Description
private boolean
allowHasTypePatterns

not thread-safe, but this class is not intended to be...

private IToken
private Set<PointcutDesignatorHandler>
pointcutDesignatorHandlers

extension handlers used in weaver tools API only

private ISourceContext
private ITokenSource
private World

Constructor Summary

AccessConstructor and Description
public
PatternParser(ITokenSource tokenSource)

Constructor for PatternParser.

public
public

Method Summary

Modifier and TypeMethod and Description
private void
assertNoTypeVariables(String[] tvs, String errorMessage, IToken token)

public void
private void
public void
eat(String expectedValue)

private void
eat(String expectedValue, String expectedMessage)

public void
eatIdentifier(String expectedValue)

private boolean
isAdjacent(IToken first, IToken second)

private boolean
public boolean
public boolean
public boolean
maybeEatIdentifier(String expectedValue)

public String
private boolean
private TypePattern[]
public AnnotationTypePattern
public PerClause
public String[]
public AnnotationTypePattern
public TypePatternList
public TypeVariablePatternList
maybeParseTypeVariableList()

Parse type variable declarations for a generic method or at the start of a signature pointcut to identify type variable names in a generic type.

public boolean
private IToken
protected ExactAnnotationTypePattern
public String
public Pointcut
public Map<String, String>
private Pointcut
private Pointcut

Returns:

Pointcut
parseArgsPointcut
()

Method parseArgsPointcut.

public AnnotationPatternList
public TypePatternList
parseArgumentsPattern(boolean parameterAnnotationsPossible)

private Pointcut
private Pointcut
private TypePattern
parseAtomicTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible)

private Pointcut
parseCflowPointcut(boolean isBelow)

public ISignaturePattern
public ISignaturePattern
private SignaturePattern
public Declare
public Declare
public DeclareAnnotation
public DeclareAnnotation
parseDeclareAtMethod(boolean isMethod)

public DeclareAnnotation
private Pointcut
public DeclarePrecedence
public List<String>
public List<NamePattern>
private Declare

Returns:

the new declare
parseErrorOrWarning
(boolean
true if it is declare error rather than declare warning
isError
)

Attempt to parse a pointcut, if that fails then try again for a type pattern.

public SignaturePattern
public TypePattern
public TypePattern
public TypePattern
public String
public TypePattern

Returns:

a TypeIsTypePattern or null if could not be parsed
parseIsTypePattern
()

Attempt to parse a typeIs(<category>) construct.

private KindedPointcut
public ISignaturePattern
public ISignaturePattern
public SignaturePattern
public ModifiersPattern
private KindedPointcut
parseMonitorPointcut(String kind)

Covers the 'lock()' and 'unlock()' pointcuts

public NamePattern
private Pointcut
private TypePattern
parseNotOrTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible)

public ThrowsPattern
private Declare
private PerClause
parsePerCflow(boolean isBelow)

private PerClause
parsePerObject(boolean isThis)

private PerClause
private PerClause
public Pointcut
parsePointcut(boolean shouldConsumeAllInput)

public Pointcut
public String
parsePossibleStringSequence(boolean shouldEnd)

private Pointcut
private ExactAnnotationTypePattern
public Pointcut
public TypePattern
public TypePattern
parseSingleTypePattern(boolean insideTypeParameters)

private Declare
public String
private Pointcut
private Pointcut

Returns:

Pointcut
parseThisOrTargetPointcut
(String kind)

Method parseThisOrTargetPointcut.

public TypePattern
public TypePattern
parseTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible)

public TypeVariablePattern
private Pointcut
private Pointcut
private Pointcut
private Pointcut

Returns:

Pointcut
parseWithinPointcut
()

Method parseWithinPointcut.

public boolean
peek(String token)

private TypePattern
setAnnotationPatternForTypePattern(TypePattern t, AnnotationTypePattern ap, boolean parameterAnnotationsPattern)

public void
setPointcutDesignatorHandlers(Set<PointcutDesignatorHandler> handlers, World world)

only used by weaver tools API

private NamePattern
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allowHasTypePatternsback to summary
private boolean allowHasTypePatterns

not thread-safe, but this class is not intended to be...

pendingRightArrowsback to summary
private IToken pendingRightArrows
pointcutDesignatorHandlersback to summary
private Set<PointcutDesignatorHandler> pointcutDesignatorHandlers

extension handlers used in weaver tools API only

sourceContextback to summary
private ISourceContext sourceContext
tokenSourceback to summary
private ITokenSource tokenSource
worldback to summary
private World world

Constructor Detail

PatternParserback to summary
public PatternParser(ITokenSource tokenSource)

Constructor for PatternParser.

PatternParserback to summary
public PatternParser(String data)
PatternParserback to summary
public PatternParser(String data, ISourceContext context)

Method Detail

assertNoTypeVariablesback to summary
private void assertNoTypeVariables(String[] tvs, String errorMessage, IToken token)
checkEofback to summary
public void checkEof()
checkLegalNameback to summary
private void checkLegalName(String s, IToken tok)
eatback to summary
public void eat(String expectedValue)
eatback to summary
private void eat(String expectedValue, String expectedMessage)
eatIdentifierback to summary
public void eatIdentifier(String expectedValue)
isAdjacentback to summary
private boolean isAdjacent(IToken first, IToken second)
isEitherAndOrOrback to summary
private boolean isEitherAndOrOr()
maybeEatback to summary
public boolean maybeEat(String token)
maybeEatAdjacentback to summary
public boolean maybeEatAdjacent(String token)
maybeEatIdentifierback to summary
public boolean maybeEatIdentifier(String expectedValue)
maybeEatIdentifierback to summary
public String maybeEatIdentifier()
maybeEatNewback to summary
private boolean maybeEatNew(TypePattern returnType)
maybeParseAdditionalInterfaceBoundsback to summary
private TypePattern[] maybeParseAdditionalInterfaceBounds()
maybeParseAnnotationPatternback to summary
public AnnotationTypePattern maybeParseAnnotationPattern()
maybeParsePerClauseback to summary
public PerClause maybeParsePerClause()
maybeParseSimpleTypeVariableListback to summary
public String[] maybeParseSimpleTypeVariableList()
maybeParseSingleAnnotationPatternback to summary
public AnnotationTypePattern maybeParseSingleAnnotationPattern()
maybeParseTypeParameterListback to summary
public TypePatternList maybeParseTypeParameterList()
maybeParseTypeVariableListback to summary
public TypeVariablePatternList maybeParseTypeVariableList()

Parse type variable declarations for a generic method or at the start of a signature pointcut to identify type variable names in a generic type.

moreToParseback to summary
public boolean moreToParse()
nextTokenback to summary
private IToken nextToken()
parseAnnotationNameOrVarTypePatternback to summary
protected ExactAnnotationTypePattern parseAnnotationNameOrVarTypePattern()
parseAnnotationNameValuePatternback to summary
public String parseAnnotationNameValuePattern()
parseAnnotationPointcutback to summary
public Pointcut parseAnnotationPointcut()
parseAnnotationValuesback to summary
public Map<String, String> parseAnnotationValues()
parseArgsAnnotationPointcutback to summary
private Pointcut parseArgsAnnotationPointcut()
parseArgsPointcutback to summary
private Pointcut parseArgsPointcut()

Method parseArgsPointcut.

Returns:Pointcut

Pointcut

parseArgumentsAnnotationPatternback to summary
public AnnotationPatternList parseArgumentsAnnotationPattern()
parseArgumentsPatternback to summary
public TypePatternList parseArgumentsPattern(boolean parameterAnnotationsPossible)
parseAtAnnotationPointcutback to summary
private Pointcut parseAtAnnotationPointcut()
parseAtomicPointcutback to summary
private Pointcut parseAtomicPointcut()
parseAtomicTypePatternback to summary
private TypePattern parseAtomicTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible)
parseCflowPointcutback to summary
private Pointcut parseCflowPointcut(boolean isBelow)
parseCompoundFieldSignaturePatternback to summary
public ISignaturePattern parseCompoundFieldSignaturePattern()
parseCompoundMethodOrConstructorSignaturePatternback to summary
public ISignaturePattern parseCompoundMethodOrConstructorSignaturePattern(boolean isMethod)
parseConstructorSignaturePatternback to summary
private SignaturePattern parseConstructorSignaturePattern()
parseDeclareback to summary
public Declare parseDeclare()
parseDeclareAnnotationback to summary
public Declare parseDeclareAnnotation()
parseDeclareAtFieldback to summary
public DeclareAnnotation parseDeclareAtField()
parseDeclareAtMethodback to summary
public DeclareAnnotation parseDeclareAtMethod(boolean isMethod)
parseDeclareAtTypeback to summary
public DeclareAnnotation parseDeclareAtType()
parseDesignatorPointcutback to summary
private Pointcut parseDesignatorPointcut(PointcutDesignatorHandler pcdHandler)
parseDominatesback to summary
public DeclarePrecedence parseDominates()
parseDottedIdentifierback to summary
public List<String> parseDottedIdentifier()
parseDottedNamePatternback to summary
public List<NamePattern> parseDottedNamePattern()
parseErrorOrWarningback to summary
private Declare parseErrorOrWarning(boolean isError)

Attempt to parse a pointcut, if that fails then try again for a type pattern.

Parameters
isError:boolean

true if it is declare error rather than declare warning

Returns:Declare

the new declare

parseFieldSignaturePatternback to summary
public SignaturePattern parseFieldSignaturePattern()
parseGenericsWildcardTypePatternback to summary
public TypePattern parseGenericsWildcardTypePattern()
parseHasFieldTypePatternback to summary
public TypePattern parseHasFieldTypePattern()
parseHasMethodTypePatternback to summary
public TypePattern parseHasMethodTypePattern()
parseIdentifierback to summary
public String parseIdentifier()
parseIsTypePatternback to summary
public TypePattern parseIsTypePattern()

Attempt to parse a typeIs(<category>) construct. If it cannot be parsed we just return null and that should cause the caller to reset their position and attempt to consume it in another way. This means we won't have problems here: execution(* typeIs(..)) because someone has decided to call a method the same as our construct.

Returns:TypePattern

a TypeIsTypePattern or null if could not be parsed

parseKindedPointcutback to summary
private KindedPointcut parseKindedPointcut(String kind)
parseMaybeParenthesizedFieldSignaturePatternback to summary
public ISignaturePattern parseMaybeParenthesizedFieldSignaturePattern()
parseMaybeParenthesizedMethodOrConstructorSignaturePatternback to summary
public ISignaturePattern parseMaybeParenthesizedMethodOrConstructorSignaturePattern(boolean isMethod)
parseMethodOrConstructorSignaturePatternback to summary
public SignaturePattern parseMethodOrConstructorSignaturePattern()
parseModifiersPatternback to summary
public ModifiersPattern parseModifiersPattern()
parseMonitorPointcutback to summary
private KindedPointcut parseMonitorPointcut(String kind)

Covers the 'lock()' and 'unlock()' pointcuts

parseNamePatternback to summary
public NamePattern parseNamePattern()
parseNotOrPointcutback to summary
private Pointcut parseNotOrPointcut()
parseNotOrTypePatternback to summary
private TypePattern parseNotOrTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible)
parseOptionalThrowsPatternback to summary
public ThrowsPattern parseOptionalThrowsPattern()
parseParentsback to summary
private Declare parseParents()
parsePerCflowback to summary
private PerClause parsePerCflow(boolean isBelow)
parsePerObjectback to summary
private PerClause parsePerObject(boolean isThis)
parsePerSingletonback to summary
private PerClause parsePerSingleton()
parsePerTypeWithinback to summary
private PerClause parsePerTypeWithin()
parsePointcutback to summary
public Pointcut parsePointcut(boolean shouldConsumeAllInput)
parsePointcutback to summary
public Pointcut parsePointcut()
parsePossibleStringSequenceback to summary
public String parsePossibleStringSequence(boolean shouldEnd)
parseReferencePointcutback to summary
private Pointcut parseReferencePointcut()
parseSimpleAnnotationNameback to summary
private ExactAnnotationTypePattern parseSimpleAnnotationName()
parseSinglePointcutback to summary
public Pointcut parseSinglePointcut()
parseSingleTypePatternback to summary
public TypePattern parseSingleTypePattern()
parseSingleTypePatternback to summary
public TypePattern parseSingleTypePattern(boolean insideTypeParameters)
parseSoftback to summary
private Declare parseSoft()
parseStringLiteralback to summary
public String parseStringLiteral()
parseThisOrTargetAnnotationPointcutback to summary
private Pointcut parseThisOrTargetAnnotationPointcut()
parseThisOrTargetPointcutback to summary
private Pointcut parseThisOrTargetPointcut(String kind)

Method parseThisOrTargetPointcut.

Returns:Pointcut

Pointcut

parseTypePatternback to summary
public TypePattern parseTypePattern()
parseTypePatternback to summary
public TypePattern parseTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible)
parseTypeVariableback to summary
public TypeVariablePattern parseTypeVariable()
parseWithinAnnotationPointcutback to summary
private Pointcut parseWithinAnnotationPointcut()
parseWithinCodeAnnotationPointcutback to summary
private Pointcut parseWithinCodeAnnotationPointcut()
parseWithinCodePointcutback to summary
private Pointcut parseWithinCodePointcut()
parseWithinPointcutback to summary
private Pointcut parseWithinPointcut()

Method parseWithinPointcut.

Returns:Pointcut

Pointcut

peekback to summary
public boolean peek(String token)
setAnnotationPatternForTypePatternback to summary
private TypePattern setAnnotationPatternForTypePattern(TypePattern t, AnnotationTypePattern ap, boolean parameterAnnotationsPattern)
setPointcutDesignatorHandlersback to summary
public void setPointcutDesignatorHandlers(Set<PointcutDesignatorHandler> handlers, World world)

only used by weaver tools API

tryToExtractNameback to summary
private NamePattern tryToExtractName(TypePattern nextType)