Package org.aspectj.weaver.patterns

Examples of org.aspectj.weaver.patterns.Pointcut


    if (toLookFor.isInstance(toSearch)) {
      return toSearch;
    }
    if (toSearch instanceof AndPointcut) {
      AndPointcut apc = (AndPointcut) toSearch;
      Pointcut left = findFirstPointcutIn(apc.getLeft(), toLookFor);
      if (left != null) {
        return left;
      }
      return findFirstPointcutIn(apc.getRight(), toLookFor);
    }
View Full Code Here


          ResolvedType declaringAspect = munger.getDeclaringType();
          if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) {
            continue;
          }
        }
        Pointcut pointcut = munger.getPointcut();
        long starttime = System.nanoTime();
        FuzzyBoolean fb = pointcut.fastMatch(info);
        long endtime = System.nanoTime();
        world.recordFastMatch(pointcut, endtime - starttime);
        if (fb.maybeTrue()) {
          result.add(munger);
        }
      }
    } else {
      for (ShadowMunger munger : list) {
        if (typeWeaverState != null) { // will only be null if overweaving is ON and there is weaverstate
          ResolvedType declaringAspect = munger.getConcreteAspect();// getDeclaringType();
          if (typeWeaverState.isAspectAlreadyApplied(declaringAspect)) {
            continue;
          }
        }
        Pointcut pointcut = munger.getPointcut();
        FuzzyBoolean fb = pointcut.fastMatch(info);
        if (fb.maybeTrue()) {
          result.add(munger);
        }
      }
    }
View Full Code Here

   * @param clause has been concretized at a higher level
   */
  @Override
  public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
    // assert !fromType.isAbstract();
    Pointcut p = pointcut.concretize(fromType, getDeclaringType(), signature.getArity(), this);
    if (clause != null) {
      Pointcut oldP = p;
      p = new AndPointcut(clause, p);
      p.copyLocationFrom(oldP);
      p.state = Pointcut.CONCRETE;

      // FIXME ? ATAJ copy unbound bindings to ignore
View Full Code Here

   */
  public StandardPointcutExpression parsePointcutExpression(String expression, Class inScope, PointcutParameter[] formalParameters)
      throws UnsupportedPointcutPrimitiveException, IllegalArgumentException {
    StandardPointcutExpressionImpl pcExpr = null;
    try {
      Pointcut pc = resolvePointcutExpression(expression, inScope, formalParameters);
      pc = concretizePointcutExpression(pc, inScope, formalParameters);
      validateAgainstSupportedPrimitives(pc, expression); // again, because we have now followed any ref'd pcuts
      pcExpr = new StandardPointcutExpressionImpl(pc, expression, formalParameters, getWorld());
    } catch (ParserException pEx) {
      throw new IllegalArgumentException(buildUserMessageFromParserException(expression, pEx));
View Full Code Here

  protected Pointcut resolvePointcutExpression(String expression, Class<?> inScope, PointcutParameter[] formalParameters) {
    try {
      PatternParser parser = new PatternParser(expression);
      parser.setPointcutDesignatorHandlers(pointcutDesignators, world);
      Pointcut pc = parser.parsePointcut();
      validateAgainstSupportedPrimitives(pc, expression);
      IScope resolutionScope = buildResolutionScope((inScope == null ? Object.class : inScope), formalParameters);
      pc = pc.resolve(resolutionScope);
      return pc;
    } catch (ParserException pEx) {
      throw new IllegalArgumentException(buildUserMessageFromParserException(expression, pEx));
    }
  }
View Full Code Here

      IProgramElement containingAspect, ResolvedMember[] pointcuts) {
    for (int i = 0; i < pointcuts.length; i++) {
      ResolvedMember pointcut = pointcuts[i];
      if (pointcut instanceof ResolvedPointcutDefinition) {
        ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pointcut;
        Pointcut p = rpcd.getPointcut();
        ISourceLocation sLoc = (p == null ? null : p.getSourceLocation());
        if (sLoc == null) {
          sLoc = rpcd.getSourceLocation();
        }
        ISourceLocation pointcutLocation = (sLoc == null ? null : createSourceLocation(sourcefilename, aspect, sLoc));
        ProgramElement pointcutElement = new ProgramElement(model, pointcut.getName(), IProgramElement.Kind.POINTCUT,
View Full Code Here

  private static void addChildNodes(AsmManager asm, ResolvedType aspect, IProgramElement parent, ResolvedMember[] children) {
    for (int i = 0; i < children.length; i++) {
      ResolvedMember pcd = children[i];
      if (pcd instanceof ResolvedPointcutDefinition) {
        ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pcd;
        Pointcut p = rpcd.getPointcut();
        ISourceLocation sLoc = (p == null ? null : p.getSourceLocation());
        if (sLoc == null) {
          sLoc = rpcd.getSourceLocation();
        }
        parent.addChild(new ProgramElement(asm, pcd.getName(), IProgramElement.Kind.POINTCUT, getBinarySourceLocation(
            aspect, sLoc), pcd.getModifiers(), null, Collections.<IProgramElement>emptyList()));
View Full Code Here

   */
  public PointcutExpression parsePointcutExpression(String expression, Class inScope, PointcutParameter[] formalParameters)
      throws UnsupportedPointcutPrimitiveException, IllegalArgumentException {
    PointcutExpressionImpl pcExpr = null;
    try {
      Pointcut pc = resolvePointcutExpression(expression, inScope, formalParameters);
      pc = concretizePointcutExpression(pc, inScope, formalParameters);
      validateAgainstSupportedPrimitives(pc, expression); // again, because we have now followed any ref'd pcuts
      pcExpr = new PointcutExpressionImpl(pc, expression, formalParameters, getWorld());
    } catch (ParserException pEx) {
      throw new IllegalArgumentException(buildUserMessageFromParserException(expression, pEx));
View Full Code Here

  protected Pointcut resolvePointcutExpression(String expression, Class inScope, PointcutParameter[] formalParameters) {
    try {
      PatternParser parser = new PatternParser(expression);
      parser.setPointcutDesignatorHandlers(pointcutDesignators, world);
      Pointcut pc = parser.parsePointcut();
      validateAgainstSupportedPrimitives(pc, expression);
      IScope resolutionScope = buildResolutionScope((inScope == null ? Object.class : inScope), formalParameters);
      pc = pc.resolve(resolutionScope);
      return pc;
    } catch (ParserException pEx) {
      throw new IllegalArgumentException(buildUserMessageFromParserException(expression, pEx));
    }
  }
View Full Code Here

      DeclareSoft d = (DeclareSoft) declare;
      // Ordered so that during concretization we can check the related
      // munger
      ShadowMunger m = Advice.makeSoftener(world, d.getPointcut(), d.getException(), inAspect, d);
      m.setDeclaringType(d.getDeclaringType());
      Pointcut concretePointcut = d.getPointcut().concretize(inAspect, d.getDeclaringType(), 0, m);
      m.pointcut = concretePointcut;
      declareSofts.add(new DeclareSoft(d.getException(), concretePointcut));
      addConcreteShadowMunger(m);
    } else if (declare instanceof DeclareAnnotation) {
      // FIXME asc perf Possible Improvement. Investigate why this is
View Full Code Here

TOP

Related Classes of org.aspectj.weaver.patterns.Pointcut

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.