/** * Invoked when a method exits (possibly returning a value). * * @param invocation identifies method invocation and result value */ public void exit(MethodInvocation invocation) { StringBuilder buffer = new StringBuilder(BUFFER_SIZE); buffer.append(format("[%s] %s", EXIT, invocation.getMethod().getName())); if (invocation.getMethod().getReturnType() != void.class) { buffer.append(" ["); convert(buffer, invocation.getReturnValue()); buffer.append(']'); } logger.debug(buffer.toString()); }
/** * Invoked when a method exits (possibly returning a value). * * @param invocation identifies method invocation and result value */ public void exit(MethodInvocation invocation) { StringBuilder buffer = new StringBuilder(BUFFER_SIZE); buffer.append(format("[%s] %s", EXIT, invocation.getMethod().getName())); if (invocation.getMethod().getReturnType() != void.class) { buffer.append(" ["); convert(buffer, invocation.getReturnValue()); buffer.append(']'); } logger.debug(buffer.toString()); }
@Override protected Object proceed(MethodInvocation invocation) throws Throwable { invocation.proceed(); if (invocation.didThrowCheckedException()) { invocation.rethrow(); } return invocation.getReturnValue(); }
@Override protected Object proceed(MethodInvocation invocation) throws Throwable { invocation.proceed(); if (invocation.didThrowCheckedException()) { invocation.rethrow(); } return invocation.getReturnValue(); }
@Override protected Object proceed(MethodInvocation invocation) throws Throwable { invocation.proceed(); if (invocation.didThrowCheckedException()) { invocation.rethrow(); } return invocation.getReturnValue(); }
@Override protected Object proceed(MethodInvocation invocation) throws Throwable { invocation.proceed(); if (invocation.didThrowCheckedException()) { invocation.rethrow(); } return invocation.getReturnValue(); }
@Override public void advise(MethodInvocation invocation) { invocation.proceed(); Storage storage = (Storage) invocation.getReturnValue(); invocation.setReturnValue(new SecureStorage(storage, indexer, securityManager, appStateManager.getIfExists(JsonSessionState.class))); } };
@Override public void advise(MethodInvocation invocation) { invocation.proceed(); String result = (String) invocation.getReturnValue(); if (result != null) invocation.setReturnValue(result.toUpperCase()); } };
@Override public void advise(MethodInvocation invocation) { invocation.proceed(); Object result = invocation.getReturnValue(); invocation.setReturnValue(String.format("%s[%s]", id, result)); } });
@Override public void advise(MethodInvocation invocation) { invocation.proceed(); Object result = invocation.getReturnValue(); invocation.setReturnValue(String.format("Decorated by %s[%s]", decoratorId, result)); } });
public void advise(MethodInvocation invocation) { MethodResultCache cache = getOrCreateCache(invocation); if (cache.isCached()) { invocation.setReturnValue(cache.get()); return; } invocation.proceed(); if(!invocation.didThrowCheckedException()) { cache.set(invocation.getReturnValue()); } }
public void advise(MethodInvocation invocation) { Class<?>[] parameterTypes = invocation.getMethod().getParameterTypes(); for (int i = 0; i < parameterTypes.length; i++) { if (parameterTypes[i].equals(String.class)) { String value = (String) invocation.getParameter(i); invocation.setParameter(i, reverse(value)); } } invocation.proceed(); if (invocation.getMethod().getReturnType().equals(String.class)) { if (invocation.didThrowCheckedException()) { Exception thrown = invocation.getCheckedException(Exception.class); invocation.setReturnValue(String.format("Invocation of method %s() failed with %s.", invocation.getMethod().getName(), thrown.getClass().getName())); return; } String value = (String) invocation.getReturnValue(); invocation.setReturnValue(reverse(value)); } }