@Test public void testNewInvocationContext() throws Exception { List<Annotation> empty = Collections.emptyList(); ParameterDescriptor p0 = ParameterDescriptor.create(0, String.class, empty, "name"); ParameterDescriptor p1 = ParameterDescriptor.create(1, int.class, empty, "id"); List<ParameterDescriptor> pds = Arrays.asList(p0, p1); ParameterContext paramCtx = DefaultParameterContext.create(pds); InvocationContextFactory factory = InvocationContextFactory.create(paramCtx); InvocationContext invCtx = factory.newInvocationContext(new Object[]{"ash", 9527}); BindingParameterInvoker nameInvoker = FunctionalBindingParameterInvoker.create(String.class, BindingParameter.create("name", "", null)); BindingParameterInvoker idInvoker = FunctionalBindingParameterInvoker.create(String.class, BindingParameter.create("id", "", null)); assertThat(invCtx.getNullableBindingValue(nameInvoker), equalTo((Object) "ash")); assertThat(invCtx.getNullableBindingValue(idInvoker), equalTo((Object) 9527)); }
public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } return context; }
InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } return context; } }
InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } return context; } private  InvocationContextFactory(ParameterContext parameterContext); }
InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } return context; } private  InvocationContextFactory(ParameterContext parameterContext); static InvocationContextFactory create(ParameterContext parameterContext); InvocationContext newInvocationContext(Object[] values); }
InvocationContextFactory { public InvocationContext newInvocationContext(Object[] values) { InvocationContext context = DefaultInvocationContext.create(); for (int i = 0; i < values.length; i++) { String parameterName = parameterContext.getParameterNameByPosition(i); context.addParameter(parameterName, values[i]); } return context; } private  InvocationContextFactory(ParameterContext parameterContext); static InvocationContextFactory create(ParameterContext parameterContext); InvocationContext newInvocationContext(Object[] values);  }