use of org.aspectj.lang.reflect.ConstructorSignature in project AndroidDevMetrics by frogermcs.
the class Dagger2GraphAnalyzer method logAndExecute.
@Around("providesMethod() || injectConstructor()")
public Object logAndExecute(ProceedingJoinPoint joinPoint) throws Throwable {
long start = System.nanoTime();
Object result = joinPoint.proceed();
long stop = System.nanoTime();
long took = TimeUnit.NANOSECONDS.toMillis(stop - start);
if (!enabled) {
return result;
}
CodeSignature codeSignature = (CodeSignature) joinPoint.getSignature();
Class<?> cls = codeSignature.getDeclaringType();
if (codeSignature instanceof ConstructorSignature) {
InitManager.getInstance().addInitMetric(cls, joinPoint.getArgs(), took);
}
if (isMethodWithReturnType(codeSignature)) {
if (result != null) {
InitManager.getInstance().addInitMetric(result.getClass(), joinPoint.getArgs(), took);
}
}
return result;
}
Aggregations