/** * Defines the aspect. * * @param classInfo * @param aspectDef * @param loader */ public void defineAspect( final ClassInfo classInfo, final AspectDefinition aspectDef, final ClassLoader loader) { ClassInfo[] interfaces = classInfo.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { ClassInfo anInterface = interfaces[i]; if (anInterface.getName().equals(MethodInterceptor.class.getName()) || anInterface.getName().equals(MethodBeforeAdvice.class.getName()) || anInterface.getName().equals(AfterReturningAdvice.class.getName()) || anInterface.getName().equals(ThrowsAdvice.class.getName())) { aspectDef.setAspectModel(ASPECT_MODEL_TYPE); aspectDef.setContainerClassName(null); return; } } }
/** * Filters the classes to be transformed. * * @param classInfo the class to filter * @param ctx the context * @param definitions a set with the definitions * @return boolean true if the method should be filtered away */ public static boolean classFilter( final ClassInfo classInfo, final ExpressionContext ctx, final Set definitions) { for (Iterator it = definitions.iterator(); it.hasNext(); ) { SystemDefinition systemDef = (SystemDefinition) it.next(); if (classInfo.isInterface()) { return true; } String className = classInfo.getName().replace('/', '.'); if (systemDef.inExcludePackage(className)) { return true; } if (!systemDef.inIncludePackage(className)) { return true; } if (systemDef.hasMixin(ctx)) { return false; } } return true; }