Example usage for org.aspectj.weaver ResolvedPointcutDefinition ResolvedPointcutDefinition

List of usage examples for org.aspectj.weaver ResolvedPointcutDefinition ResolvedPointcutDefinition

Introduction

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

Prototype

public ResolvedPointcutDefinition(UnresolvedType declaringType, int modifiers, String name,
            UnresolvedType[] parameterTypes, Pointcut pointcut) 

Source Link

Usage

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

License:Open Source License

public static CaesarMember ResolvedPointcutDefinition(ResolvedTypeX declaringType, int modifiers, String name,
        ResolvedTypeX[] parameterTypes, CaesarPointcut pointcut) {
    // convert the signatures to types
    return new CaesarMember(
            new ResolvedPointcutDefinition(declaringType, modifiers, name, parameterTypes, pointcut.wrappee()));
}

From source file:org.caesarj.compiler.export.CCjSourceClass.java

License:Open Source License

/**
 * Add the pointcut declaration made in this cclass to the list.
 * /* www. j a va2  s  . c  o m*/
 * Here a new ResolvedPointcutDefinition is created and stored in the list. When
 * resolving the pointcut, this definition is used to check if there's a related
 * pointcut. In the end, this is just a fake resolution, since the pointcuts
 * stored in the resolvedPointcuts array are the ones that will really be translated
 * to code.
 * 
 * @param cclass
 * @param pointcutDecl
 */
public void addDeclaredPointcut(CjVirtualClassDeclaration cclass, CjPointcutDeclaration pointcutDecl) {
    CjClassDeclaration registry = cclass.getRegistryClass();

    JFormalParameter[] parameters = pointcutDecl.getParameters();
    List parameterSignatures = new ArrayList();

    for (int i = 0; i < parameters.length; i++) {

        if (!parameters[i].isGenerated()) {
            CTypeContext context = pointcutDecl.getOriginalClass().getContext();
            try {
                CType type = parameters[i].getType().checkType(context);
                parameterSignatures.add(type.getSignature());
            } catch (UnpositionedError e) {
                context.reportTrouble(e.addPosition(pointcutDecl.getTokenReference()));
            }
        }
    }

    TypeX parameterTypes[] = TypeX.forSignatures((String[]) parameterSignatures.toArray(new String[0]));

    TypeX declaringType = TypeX.forName(registry.getSourceClass().getQualifiedName());

    ResolvedPointcutDefinition resolvedPointcutDeclaration = new ResolvedPointcutDefinition(declaringType,
            pointcutDecl.getModifiers(), pointcutDecl.getIdent(), parameterTypes,
            pointcutDecl.getPointcut().wrappee());

    resolvedPointcutDeclaration.setPosition(pointcutDecl.getTokenReference().getLine(),
            pointcutDecl.getTokenReference().getLine());

    declaredPointcuts.add(resolvedPointcutDeclaration);
}