*/
public static boolean classFilter(final ClassInfo classInfo, final Set definitions) {
ExpressionContext ctx = new ExpressionContext(PointcutType.WITHIN, classInfo, classInfo);
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;
}
// match on perinstance deployed aspects
Collection adviceDefs = systemDef.getAdviceDefinitions();
for (Iterator defs = adviceDefs.iterator(); defs.hasNext();) {
AdviceDefinition adviceDef = (AdviceDefinition) defs.next();
ExpressionInfo expressionInfo = adviceDef.getExpressionInfo();
if (expressionInfo == null) {
continue;
}
if (expressionInfo.getAdvisedClassFilterExpression().match(ctx) &&
adviceDef.getAspectDefinition().getDeploymentModel().equals(DeploymentModel.PER_INSTANCE)) {
return false;
}
}
// match on deployment scopes, e.g. potential perinstance deployment aspects
Collection deploymentScopes = systemDef.getDeploymentScopes();
for (Iterator scopes = deploymentScopes.iterator(); scopes.hasNext();) {
DeploymentScope deploymentScope = (DeploymentScope) scopes.next();
ExpressionInfo expression = new ExpressionInfo(
deploymentScope.getExpression(),
systemDef.getUuid()
);
if (expression.getAdvisedClassFilterExpression().match(ctx)) {
return false;
}
}