@Test public void testGetParameterNameByPosition() throws Exception { List<Annotation> empty = Collections.emptyList(); ParameterDescriptor p0 = ParameterDescriptor.create(0, String.class, empty, "param1"); ParameterDescriptor p1 = ParameterDescriptor.create(1, int.class, empty, "param2"); List<ParameterDescriptor> pds = Arrays.asList(p0, p1); ParameterContext ctx = DefaultParameterContext.create(pds); assertThat(ctx.getParameterNameByPosition(0), equalTo("param1")); assertThat(ctx.getParameterNameByPosition(1), equalTo("param2")); }
@Override public String getParameterNameByPosition(int position) { String name = positionToNameMap.get(position); if (name == null) { throw new IllegalStateException("parameter name can not be found by position [" + position + "]"); } return name; }
DefaultParameterContext implements ParameterContext { @Override public String getParameterNameByPosition(int position) { String name = positionToNameMap.get(position); if (name == null) { throw new IllegalStateException("parameter name can not be found by position [" + position + "]"); } return name; } }
DefaultParameterContext implements ParameterContext { @Override public String getParameterNameByPosition(int position) { String name = positionToNameMap.get(position); if (name == null) { throw new IllegalStateException("parameter name can not be found by position [" + position + "]"); } return name; } private  DefaultParameterContext(List<ParameterDescriptor> parameterDescriptors); }
DefaultParameterContext implements ParameterContext { @Override public String getParameterNameByPosition(int position) { String name = positionToNameMap.get(position); if (name == null) { throw new IllegalStateException("parameter name can not be found by position [" + position + "]"); } return name; } private  DefaultParameterContext(List<ParameterDescriptor> parameterDescriptors); static DefaultParameterContext create(List<ParameterDescriptor> parameterDescriptors); @Override String getParameterNameByPosition(int position); @Override BindingParameterInvoker getBindingParameterInvoker(BindingParameter bindingParameter); @Override List<ParameterDescriptor> getParameterDescriptors(); @Override @Nullable BindingParameter tryExpandBindingParameter(BindingParameter bindingParameter); }
DefaultParameterContext implements ParameterContext { @Override public String getParameterNameByPosition(int position) { String name = positionToNameMap.get(position); if (name == null) { throw new IllegalStateException("parameter name can not be found by position [" + position + "]"); } return name; } private  DefaultParameterContext(List<ParameterDescriptor> parameterDescriptors); static DefaultParameterContext create(List<ParameterDescriptor> parameterDescriptors); @Override String getParameterNameByPosition(int position); @Override BindingParameterInvoker getBindingParameterInvoker(BindingParameter bindingParameter); @Override List<ParameterDescriptor> getParameterDescriptors(); @Override @Nullable BindingParameter tryExpandBindingParameter(BindingParameter bindingParameter);  }