@Override protected Object[] getParameters(MethodInvocation invocation) { Object[] parameters = new Object[invocation.getMethod().getParameterTypes().length]; for (int i = 0; i < parameters.length; i++) { parameters[i] = invocation.getParameter(i); } return parameters; }
private Object[] extractParameters(MethodInvocation invocation) { int count = invocation.getMethod().getParameterTypes().length; Object[] result = new Object[count]; for (int i = 0; i < count; i++) { result[i] = invocation.getParameter(i); } return result; } }
private Object[] extractParameters(MethodInvocation invocation) { int count = invocation.getMethod().getParameterTypes().length; Object[] result = new Object[count]; for (int i = 0; i < count; i++) { result[i] = invocation.getParameter(i); } return result; } }
@Override protected Object[] getParameters(MethodInvocation invocation) { Object[] parameters = new Object[invocation.getMethod().getParameterTypes().length]; for (int i = 0; i < parameters.length; i++) { parameters[i] = invocation.getParameter(i); } return parameters; }
/** * Invoked when a method is first entered * * @param invocation identifies method invoked as well as parameters passed to method */ public void entry(MethodInvocation invocation) { StringBuilder buffer = new StringBuilder(BUFFER_SIZE); buffer.append(format("[%s] %s(", ENTER, invocation.getMethod().getName())); for (int i = 0; i < invocation.getMethod().getParameterTypes().length; i++) { if (i > 0) buffer.append(", "); convert(buffer, invocation.getParameter(i)); } buffer.append(')'); logger.debug(buffer.toString()); }
/** * Invoked when a method is first entered * * @param invocation identifies method invoked as well as parameters passed to method */ public void entry(MethodInvocation invocation) { StringBuilder buffer = new StringBuilder(BUFFER_SIZE); buffer.append(format("[%s] %s(", ENTER, invocation.getMethod().getName())); for (int i = 0; i < invocation.getMethod().getParameterTypes().length; i++) { if (i > 0) buffer.append(", "); convert(buffer, invocation.getParameter(i)); } buffer.append(')'); logger.debug(buffer.toString()); }
@Override public void advise(MethodInvocation invocation) { String className = (String) invocation.getParameter(0); final Class<?> replacement = componentReplacer.getReplacement(className); if (replacement != null) { invocation.setParameter(0, replacement.getName()); } invocation.proceed(); } };
@Override public void advise(MethodInvocation invocation) { SearchRequest request = (SearchRequest) invocation.getParameter(0); boolean hasSecurityFilter = false; Set<String> fqList = request.getParams("fq");
public void advise(MethodInvocation invocation) { MarkupWriter writer = (MarkupWriter) invocation.getParameter(0); invocation.proceed(); Element el = writer.getElement().getElementByAttributeValue("class", "t-calendar-trigger"); if(el != null){ el.remove(); } } });
public void advise(final MethodInvocation invocation) { final ComponentEvent event = (ComponentEvent) invocation.getParameter(0); boolean matches = !event.isAborted() && event.matches(eventType, "", minContextValues); if (matches) { tracker.run(operationDescription, new Runnable() { public void run() { Component instance = (Component) invocation.getInstance(); handler.handleEvent(instance, event); } }); } // Order of operations is key here. This logic takes precedence; base class event dispatch and event handler methods // in the class come AFTER. invocation.proceed(); if (matches) { invocation.setReturnValue(true); } } }
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)); } }