Class<?> declaringType = context.getDeclaringType(); if (Closeable.class == declaringType || AutoCloseable.class == declaringType) { String clientId = clientAnnotation.getValue(String.class).orElse(null);
private String methodInSignature( MethodInvocationContext<Object, Object> ctx ) { Method method = ctx.getTargetMethod(); String beanName = ctx.getDeclaringType().getName(); String methodName = method.getName(); return beanName + "." + methodName + "(" + ctx.getParameters() + ")"; }
@Override public Object intercept( MethodInvocationContext<Object, Object> ctx ) { Object retVal; Logger log = LoggerFactory.getLogger( ctx.getDeclaringType().getClass() ); Date start = new Date(); Loggable annotation = ctx.getDeclaringType().getAnnotation( Loggable.class ); try { if ( log.isDebugEnabled() && annotation.value() ) { log.debug( printBefore( ctx ) ); } retVal = ctx.proceed(); if ( log.isDebugEnabled() && annotation.value() ) { long duration = new Date().getTime() - start.getTime(); log.debug( printAfter( ctx, retVal, duration ) ); } } catch ( Throwable throwable ) { if ( log.isErrorEnabled() && annotation.value() ) { log.error( printError( ctx, throwable ), throwable ); } throw throwable; } return retVal; }
Class<?> declaringType = context.getDeclaringType(); if (Closeable.class == declaringType || AutoCloseable.class == declaringType) { String clientId = clientAnnotation.getValue(String.class).orElse(null);
Class<?> declaringType = context.getDeclaringType(); if (Closeable.class == declaringType || AutoCloseable.class == declaringType) { String clientId = clientAnnotation.getValue(String.class).orElse(null);