List of usage examples for org.aspectj.weaver ResolvedPointcutDefinition setPosition
public void setPosition(int sourceStart, int sourceEnd)
From source file:org.caesarj.compiler.export.CCjSourceClass.java
License:Open Source License
/** * Add the pointcut declaration made in this cclass to the list. * //from ww w . j av a2s . 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); }