Package org.aspectj.weaver.patterns

Examples of org.aspectj.weaver.patterns.PatternParser


        } else if (include.equals("*")) {
          includeStar = true;
        } else if ((fastMatchInfo = looksLikeExactName(include)) != null) {
          includeExactName.add(fastMatchInfo);
        } else {
          TypePattern includePattern = new PatternParser(include).parseTypePattern();
          includeTypePattern.add(includePattern);
        }
      }
      for (Iterator<String> iterator1 = definition.getExcludePatterns().iterator(); iterator1.hasNext();) {
        hasExcludes = true;
        String exclude = iterator1.next();
        fastMatchInfo = looksLikeStartsWith(exclude);
        if (fastMatchInfo != null) {
          excludeStartsWith.add(fastMatchInfo);
        } else if ((fastMatchInfo = looksLikeStarDotDotStarExclude(exclude)) != null) {
          excludeStarDotDotStar.add(fastMatchInfo);
        } else if ((fastMatchInfo = looksLikeExactName(exclude)) != null) {
          excludeExactName.add(exclude);
        } else if ((fastMatchInfo = looksLikeEndsWith(exclude)) != null) {
          excludeEndsWith.add(fastMatchInfo);
        } else if (exclude
            .equals("org.codehaus.groovy..* && !org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController*")) {
          // TODO need a more sophisticated analysis here, to allow for similar situations
          excludeSpecial.add(new String[] { "org.codehaus.groovy.",
              "org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController" });
          // for the related test:
          // } else if (exclude.equals("testdata..* && !testdata.sub.Oran*")) {
          // excludeSpecial.add(new String[] { "testdata.", "testdata.sub.Oran" });
        } else {
          TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
          excludeTypePattern.add(excludePattern);
        }
      }
    }
  }
View Full Code Here


   */
  private void registerDump(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
    for (Definition definition : definitions) {
      for (Iterator<String> iterator1 = definition.getDumpPatterns().iterator(); iterator1.hasNext();) {
        String dump = iterator1.next();
        TypePattern pattern = new PatternParser(dump).parseTypePattern();
        m_dumpTypePattern.add(pattern);
      }
      if (definition.shouldDumpBefore()) {
        m_dumpBefore = true;
      }
View Full Code Here


  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);
  }
View Full Code Here

  private void registerAspectExclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
    String fastMatchInfo = null;
    for (Definition definition : definitions) {
      for (String exclude : definition.getAspectExcludePatterns()) {
        TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
        m_aspectExcludeTypePattern.add(excludePattern);
        fastMatchInfo = looksLikeStartsWith(exclude);
        if (fastMatchInfo != null) {
          m_aspectExcludeStartsWith.add(fastMatchInfo);
        }
View Full Code Here

  private void registerAspectInclude(final BcelWeaver weaver, final ClassLoader loader, final List<Definition> definitions) {
    String fastMatchInfo = null;
    for (Definition definition : definitions) {
      for (String include : definition.getAspectIncludePatterns()) {
        TypePattern includePattern = new PatternParser(include).parseTypePattern();
        m_aspectIncludeTypePattern.add(includePattern);
        fastMatchInfo = looksLikeStartsWith(include);
        if (fastMatchInfo != null) {
          m_aspectIncludeStartsWith.add(fastMatchInfo);
        }
View Full Code Here

        } else if (include.equals("*")) {
          includeStar = true;
        } else if ((fastMatchInfo = looksLikeExactName(include)) != null) {
          includeExactName.add(fastMatchInfo);
        } else {
          TypePattern includePattern = new PatternParser(include).parseTypePattern();
          includeTypePattern.add(includePattern);
        }
      }
      for (Iterator iterator1 = definition.getExcludePatterns().iterator(); iterator1.hasNext();) {
        hasExcludes = true;
        String exclude = (String) iterator1.next();
        fastMatchInfo = looksLikeStartsWith(exclude);
        if (fastMatchInfo != null) {
          excludeStartsWith.add(fastMatchInfo);
        } else if ((fastMatchInfo = looksLikeStarDotDotStarExclude(exclude)) != null) {
          excludeStarDotDotStar.add(fastMatchInfo);
        } else if ((fastMatchInfo = looksLikeExactName(exclude)) != null) {
          excludeExactName.add(exclude);
        } else if ((fastMatchInfo = looksLikeEndsWith(exclude)) != null) {
          excludeEndsWith.add(fastMatchInfo);
        } else if (exclude
            .equals("org.codehaus.groovy..* && !org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController*")) {
          // TODO need a more sophisticated analysis here, to allow for similar situations
          excludeSpecial.add(new String[] { "org.codehaus.groovy.",
              "org.codehaus.groovy.grails.web.servlet.mvc.SimpleGrailsController" });
          // for the related test:
          // } else if (exclude.equals("testdata..* && !testdata.sub.Oran*")) {
          // excludeSpecial.add(new String[] { "testdata.", "testdata.sub.Oran" });
        } else {
          TypePattern excludePattern = new PatternParser(exclude).parseTypePattern();
          excludeTypePattern.add(excludePattern);
        }
      }
    }
  }
View Full Code Here

  private void registerDump(final BcelWeaver weaver, final ClassLoader loader, final List definitions) {
    for (Iterator iterator = definitions.iterator(); iterator.hasNext();) {
      Definition definition = (Definition) iterator.next();
      for (Iterator iterator1 = definition.getDumpPatterns().iterator(); iterator1.hasNext();) {
        String dump = (String) iterator1.next();
        TypePattern pattern = new PatternParser(dump).parseTypePattern();
        m_dumpTypePattern.add(pattern);
      }
      if (definition.shouldDumpBefore()) {
        m_dumpBefore = true;
      }
View Full Code Here

    AnnotationGen aspect = getAnnotation(runtimeAnnotations, AjcMemberMaker.DECLAREPRECEDENCE_ANNOTATION);
    if (aspect != null) {
      NameValuePair precedence = getAnnotationElement(aspect, VALUE);
      if (precedence != null) {
        String precedencePattern = precedence.getValue().stringifyValue();
        PatternParser parser = new PatternParser(precedencePattern);
        DeclarePrecedence ajPrecedence = parser.parseDominates();
        struct.ajAttributes.add(new AjAttribute.DeclareAttribute(ajPrecedence));
        return true;
      }
    }
    return false;
View Full Code Here

   * @param allowIf
   * @return pointcut, unresolved
   */
  private static Pointcut parsePointcut(String pointcutString, AjAttributeStruct struct, boolean allowIf) {
    try {
      PatternParser parser = new PatternParser(pointcutString, struct.context);
      Pointcut pointcut = parser.parsePointcut();
      parser.checkEof();
      pointcut.check(null, struct.enclosingType.getWorld());
      if (!allowIf && pointcutString.indexOf("if()") >= 0 && hasIf(pointcut)) {
        reportError("if() pointcut is not allowed at this pointcut location '" + pointcutString + "'", struct);
        return null;
      }
View Full Code Here

   * @param location
   * @return type pattern
   */
  private static TypePattern parseTypePattern(String patternString, AjAttributeStruct location) {
    try {
      TypePattern typePattern = new PatternParser(patternString).parseTypePattern();
      typePattern.setLocation(location.context, -1, -1);// FIXME -1,-1 is
      // not good
      // enough
      return typePattern;
    } catch (ParserException e) {
View Full Code Here

TOP

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

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.