@Test public void testApply() throws Exception { A a = new A(); List<Integer> list = Lists.newArrayList(1, 2, 3); String json = new Gson().toJson(list); Method m = A.class.getDeclaredMethod("setList", List.class); SetterInvoker invoker = FunctionalSetterInvoker.create("list", m); invoker.invoke(a, json); assertThat(a.getList().toString(), equalTo(list.toString())); B b = new B(3, 5); String json2 = new Gson().toJson(b); Method m2 = A.class.getDeclaredMethod("setB", B.class); SetterInvoker invoker2 = FunctionalSetterInvoker.create("b", m2); invoker2.invoke(a, json2); assertThat(a.getB(), equalTo(b)); }
@Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); } }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); }  }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); }  @Nullable @Override Object apply(@Nullable String input, Type runtimeOutputType); }
GsonToObjectFunction implements RuntimeSetterFunction<String, Object> { @Nullable @Override public Object apply(@Nullable String input, Type runtimeOutputType) { return input == null ? null : new Gson().fromJson(input, runtimeOutputType); }  @Nullable @Override Object apply(@Nullable String input, Type runtimeOutputType);  }