Example usage for org.aspectj.weaver.patterns WithinPointcut WithinPointcut

List of usage examples for org.aspectj.weaver.patterns WithinPointcut WithinPointcut

Introduction

In this page you can find the example usage for org.aspectj.weaver.patterns WithinPointcut WithinPointcut.

Prototype

public WithinPointcut(TypePattern type) 

Source Link

Usage

From source file:org.caesarj.compiler.aspectj.CaesarWrapperPatternParser.java

License:Open Source License

/**
 * Method parseWithinPointcut./*from   www .j a  v  a 2  s.  co  m*/
 * @return Pointcut
 */
private CaesarPointcutWrapper parseWithinPointcut() {
    parseIdentifier();
    eat("(");
    TypePattern type = parseTypePattern();
    eat(")");

    // Creates the wrapper and register it
    WithinPointcut p = new WithinPointcut(type);
    CaesarPointcutWrapper wrapper = new CaesarPointcutWrapper(p);
    wrapper.setTypePattern(type);
    registerPointcut(wrapper);

    // Creates something like || within(Classname_Impl_Mixin_*)
    TypePattern mixinType = createMixinType(type);

    WithinPointcut mixin = new WithinPointcut(mixinType);

    // Register the mixin
    wrapper = new CaesarPointcutWrapper(mixin, type);
    wrapper.setTypePattern(mixinType);
    registerPointcut(wrapper);

    // Creates an orPointcut for both the type and the mixin
    Pointcut orPointcut = new OrPointcut(p, mixin);

    return new CaesarPointcutWrapper(orPointcut);
}