public BeanContextMatcher(String expression) { this.expressionPattern = new NamePattern(expression); }
public AspectJTypeFilter(String typePatternExpression, @Nullable ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
@Override public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException { String className = metadataReader.getClassMetadata().getClassName(); ResolvedType resolvedType = this.world.resolve(className); return this.typePattern.matchesStatically(resolvedType); }
public TypePattern parseTypePattern(boolean insideTypeParameters, boolean parameterAnnotationsPossible) { TypePattern p = parseAtomicTypePattern(insideTypeParameters, parameterAnnotationsPossible); if (maybeEat("&&")) { p = new AndTypePattern(p, parseNotOrTypePattern(insideTypeParameters, parameterAnnotationsPossible)); } if (maybeEat("||")) { p = new OrTypePattern(p, parseTypePattern(insideTypeParameters, parameterAnnotationsPossible)); } return p; }
private Pointcut parseAtAnnotationPointcut() { parseIdentifier(); eat("("); if (maybeEat(")")) { throw new ParserException("@AnnotationName or parameter", tokenSource.peek()); } ExactAnnotationTypePattern type = parseAnnotationNameOrVarTypePattern(); eat(")"); return new AnnotationPointcut(type); }
private Pointcut parseWithinAnnotationPointcut() { /* String kind = */parseIdentifier(); eat("("); if (maybeEat(")")) { throw new ParserException("expecting @AnnotationName or parameter, but found ')'", tokenSource.peek()); } AnnotationTypePattern type = parseAnnotationNameOrVarTypePattern(); eat(")"); return new WithinAnnotationPointcut(type); }
private Pointcut parseWithinCodeAnnotationPointcut() { /* String kind = */parseIdentifier(); eat("("); if (maybeEat(")")) { throw new ParserException("expecting @AnnotationName or parameter, but found ')'", tokenSource.peek()); } ExactAnnotationTypePattern type = parseAnnotationNameOrVarTypePattern(); eat(")"); return new WithinCodeAnnotationPointcut(type); }
public TypePattern parseHasFieldTypePattern() { int startPos = tokenSource.peek(-1).getStart(); eat("("); SignaturePattern sp = parseFieldSignaturePattern(); eat(")"); int endPos = tokenSource.peek(-1).getEnd(); HasMemberTypePattern ret = new HasMemberTypePattern(sp); ret.setLocation(sourceContext, startPos, endPos); return ret; }
/** * return a copy of this signature pattern in which every type variable reference is replaced by the corresponding entry in the * map. */ @Override public SignaturePattern parameterizeWith(Map<String, UnresolvedType> typeVariableMap, World w) { SignaturePattern ret = new SignaturePattern(kind, modifiers, returnType.parameterizeWith(typeVariableMap, w), declaringType .parameterizeWith(typeVariableMap, w), name, parameterTypes.parameterizeWith(typeVariableMap, w), throwsPattern .parameterizeWith(typeVariableMap, w), annotationPattern.parameterizeWith(typeVariableMap, w)); ret.copyLocationFrom(this); return ret; }
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException { Declare ret = new DeclareSoft(TypePattern.read(s, context), Pointcut.read(s, context)); ret.readLocation(context, s); return ret; }
@Override public Declare parameterizeWith(Map typeVariableBindingMap, World w) { DeclareSoft ret = new DeclareSoft(exception.parameterizeWith(typeVariableBindingMap, w), pointcut.parameterizeWith( typeVariableBindingMap, w)); ret.copyLocationFrom(this); return ret; }
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException { DeclareParents ret = new DeclareParents(TypePattern.read(s, context), TypePatternList.read(s, context), true); // if (s.getMajorVersion()>=AjAttribute.WeaverVersionInfo.WEAVER_VERSION_MAJOR_AJ150) { // int numTypeVariablesInScope = s.readInt(); // ret.typeVariablesInScope = new String[numTypeVariablesInScope]; // for (int i = 0; i < numTypeVariablesInScope; i++) { // ret.typeVariablesInScope[i] = s.readUTF(); // } // } ret.readLocation(context, s); return ret; }
public String parseStringLiteral() { IToken token = tokenSource.next(); String literalKind = token.getLiteralKind(); if (literalKind == "string") { return token.getString(); } throw new ParserException("string", token); }
@Override public Pointcut parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) { Pointcut ret = new KindedPointcut(kind, signature.parameterizeWith(typeVariableMap, w), munger); ret.copyLocationFrom(this); return ret; }
public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException { Declare ret = new DeclarePrecedence(TypePatternList.read(s, context)); ret.readLocation(context, s); return ret; }
public AspectJTypeFilter(String typePatternExpression, @Nullable ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
@Override public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException { String className = metadataReader.getClassMetadata().getClassName(); ResolvedType resolvedType = this.world.resolve(className); return this.typePattern.matchesStatically(resolvedType); }
public AspectJTypeFilter(String typePatternExpression, ClassLoader classLoader) { this.world = new BcelWorld(classLoader, IMessageHandler.THROW, null); this.world.setBehaveInJava5Way(true); PatternParser patternParser = new PatternParser(typePatternExpression); TypePattern typePattern = patternParser.parseTypePattern(); typePattern.resolve(this.world); IScope scope = new SimpleScope(this.world, new FormalBinding[0]); this.typePattern = typePattern.resolveBindings(scope, Bindings.NONE, false, false); }
public boolean match(MetadataReader metadataReader, MetadataReaderFactory metadataReaderFactory) throws IOException { String className = metadataReader.getClassMetadata().getClassName(); ResolvedType resolvedType = this.world.resolve(className); return this.typePattern.matchesStatically(resolvedType); }