Example usage for org.springframework.aop.aspectj.annotation NotAnAtAspectException NotAnAtAspectException

List of usage examples for org.springframework.aop.aspectj.annotation NotAnAtAspectException NotAnAtAspectException

Introduction

In this page you can find the example usage for org.springframework.aop.aspectj.annotation NotAnAtAspectException NotAnAtAspectException.

Prototype

public NotAnAtAspectException(Class<?> nonAspectClass) 

Source Link

Document

Create a new NotAnAtAspectException for the given class.

Usage

From source file:org.springframework.aop.aspectj.annotation.AbstractAspectJAdvisorFactory.java

@Override
public void validate(Class<?> aspectClass) throws AopConfigException {
    // If the parent has the annotation and isn't abstract it's an error
    if (aspectClass.getSuperclass().getAnnotation(Aspect.class) != null
            && !Modifier.isAbstract(aspectClass.getSuperclass().getModifiers())) {
        throw new AopConfigException("[" + aspectClass.getName() + "] cannot extend concrete aspect ["
                + aspectClass.getSuperclass().getName() + "]");
    }//from ww  w .j  a  va 2 s .c om

    AjType<?> ajType = AjTypeSystem.getAjType(aspectClass);
    if (!ajType.isAspect()) {
        throw new NotAnAtAspectException(aspectClass);
    }
    if (ajType.getPerClause().getKind() == PerClauseKind.PERCFLOW) {
        throw new AopConfigException(aspectClass.getName() + " uses percflow instantiation model: "
                + "This is not supported in Spring AOP.");
    }
    if (ajType.getPerClause().getKind() == PerClauseKind.PERCFLOWBELOW) {
        throw new AopConfigException(aspectClass.getName() + " uses percflowbelow instantiation model: "
                + "This is not supported in Spring AOP.");
    }
}