{
public static Interceptor createInterceptor(Advisor advisor, Joinpoint joinpoint, AspectDefinition def, String adviceName) throws Exception
{
if (joinpoint instanceof MethodJoinpoint)
{
MethodJoinpoint method = (MethodJoinpoint) joinpoint;
if (Modifier.isStatic(method.getMethod().getModifiers()))
{
return PerVmAdvice.generateInterceptor(joinpoint, def.getFactory().createPerJoinpoint(advisor, joinpoint), adviceName);
}
}
else if (joinpoint instanceof ConstructorJoinpoint)
{
return PerVmAdvice.generateInterceptor(joinpoint, def.getFactory().createPerJoinpoint(advisor, joinpoint), adviceName);
}
else if (joinpoint instanceof MethodCalledByMethodJoinpoint)
{
MethodCalledByMethodJoinpoint method = (MethodCalledByMethodJoinpoint) joinpoint;
if (Modifier.isStatic(method.getCalling().getModifiers()))
{
return PerVmAdvice.generateInterceptor(joinpoint, def.getFactory().createPerJoinpoint(advisor, joinpoint), adviceName);
}
}
else if (joinpoint instanceof ConstructorCalledByMethodJoinpoint)
{
ConstructorCalledByMethodJoinpoint method = (ConstructorCalledByMethodJoinpoint) joinpoint;
if (Modifier.isStatic(method.getCalling().getModifiers()))
{
return PerVmAdvice.generateInterceptor(joinpoint, def.getFactory().createPerJoinpoint(advisor, joinpoint), adviceName);
}
}
else if (joinpoint instanceof FieldJoinpoint)