@Override public Object[] getParameters() { return context.getParameters(); }
@AroundInvoke public Object log(InvocationContext context) throws Exception { Object[] parameters = context.getParameters(); if (parameters.length > 0 && parameters[0] instanceof String) { String param = (String) parameters[0]; parameters[0] = "Hi " + param + " !"; context.setParameters(parameters); } return context.proceed(); } }
@AroundInvoke public Object log(InvocationContext context) throws Exception { Object[] parameters = context.getParameters(); if (parameters.length > 0 && parameters[0] instanceof String) { String param = (String) parameters[0]; parameters[0] = "Hi " + param + " !"; context.setParameters(parameters); } return context.proceed(); } }
@AroundInvoke public Object log(InvocationContext context) throws Exception { Object[] parameters = context.getParameters(); if (parameters.length > 0 && parameters[0] instanceof String) { String param = (String) parameters[0]; parameters[0] = param + " Nice to meet you."; context.setParameters(parameters); } return context.proceed(); } }
result = fallbackMethod.invoke(context.getTarget(), context.getParameters());
ctx.getTarget(), ctx.getMethod(), ctx.getParameters() ); getMessage( ctx.getMethod(), ctx.getParameters(), violations ), violations ); getMessage( ctx.getMethod(), ctx.getParameters(), violations ), violations );
Set<? extends ConstraintViolation<?>> violations = executableValidator.validateConstructorParameters( ctx.getConstructor(), ctx.getParameters() ); getMessage( ctx.getConstructor(), ctx.getParameters(), violations ), violations ); getMessage( ctx.getConstructor(), ctx.getParameters(), violations ), violations );
@Override public Object[] getParameters() { return wrapped.getParameters(); }
@AroundInvoke public Object defaultInterceptor(InvocationContext ctx) throws Exception { Object[] parameters = ctx.getParameters(); /* parameters will have values that will be passed to the method of the target class */ return ctx.proceed(); }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { Object[] params = ctx.getParameters(); int input = (Integer) params[0]; assertEquals(input, 10); return input + 3; } }
private Optional<ChangeEvent> getChangeEvent(InvocationContext ctx){ Object[] parameters = ctx.getParameters(); for(Object parameter:parameters){ if(parameter.getClass().equals(ChangeEvent.class)){ ChangeEvent changeEvent = (ChangeEvent)parameter; return Optional.of(changeEvent); } } return Optional.empty(); } }
@TraceeContextProviderMethod(displayName = "parameters", order = 20) public final List<String> getParameters() { List<String> result = new ArrayList<String>(); if (this.invocationContext != null) { for (Object parameter : invocationContext.getParameters()) { result.add(parameter != null ? parameter.toString() : null); } } return result.size() > 0 ? result : null; }
@AroundInvoke public Object intercept(InvocationContext ctx) throws Exception { if (ctx.getMethod().getName().equals("echo")) { return ctx.proceed() + ctx.getParameters()[0].toString(); } else { return ctx.proceed(); } }
private void validateAllRepresentations(InvocationContext ic) { for(Object obj : ic.getParameters()) { if(obj instanceof Representation) { validate(obj); } } }
private void supportForAsynchronousEJB(InvocationContext context, Method method) { Asynchronous asynchronous = method.getAnnotation(Asynchronous.class); if (asynchronous != null) { for (Object parameter : context.getParameters()) { if (parameter != null && OctopusSecurityContext.class.isAssignableFrom(parameter.getClass())) { Subject subject = ((OctopusSecurityContext) parameter).getSubject(); ThreadContext.bind(subject); } } } }
@SuppressWarnings("squid:S00112") private Object callMock(InvocationContext ctx, Class<?> javaClass) throws Throwable { try { return ctx.getMethod().invoke(invocationTargetManager.get().mock(javaClass), ctx.getParameters()); } catch (InvocationTargetException ite) { throw ite.getCause(); } } }
@AroundInvoke public Object aroundInvoke(final InvocationContext ctx) throws Exception { final Object[] objArr = ctx.getParameters(); final Message msg = (Message) objArr[0]; msg.setBooleanProperty("MethodLevelBusinessMethodInterception", true); ctx.setParameters(objArr); return ctx.proceed(); }
@AroundInvoke public Object secure(final InvocationContext ic) throws Throwable { final Object result = ic.proceed(); final Method method = ic.getMethod(); return cache.contextFor(method, method.getGenericReturnType()).filter(result, ic.getParameters()); } }
private void aroundCreateAccount(InvocationContext ctx) { if (ctx.getMethod().getName().equals("createAccount")) { Account account = (Account) ctx.getParameters()[0]; if (StringUtils.equalsIgnoreCase(paramEJB.getProperty(Constante.SEND_EMAIL_ACCOUNT_CREATION), Boolean.TRUE.toString())) { LOGGER.debug("demande d'envoi de mail :" + account); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("account", account); mailEJB.sendEmailWithTemplate(account.getUser().getUsername(), Constante.SEND_EMAIL_ACCOUNT_CREATION, properties); } } }
@intercepts(method = "set.*", argc = 1, returns = Void.class) public Object setCalled(InvocationContext ctx) throws Exception { ++stack; try { Object r = ctx.proceed(); fireEvent(ctx.getMethod().getName(), ctx.getParameters()[0]); return r; } finally { --stack; } }