@Test public void testApply() throws Exception { A a = new A(); Method m = A.class.getDeclaredMethod("setE", E.class); SetterInvoker invoker = FunctionalSetterInvoker.create("e", m); invoker.invoke(a, "Y"); assertThat(a.getE(), is(E.Y)); }
@Nullable @Override public Enum apply(@Nullable String input, Type runtimeOutputType) { if (input == null) { return null; } Class rawType = TypeToken.of(runtimeOutputType).getRawType(); Enum r = Enum.valueOf(rawType, input); return r; }
StringToEnumFunction implements RuntimeSetterFunction<String, Enum> { @Nullable @Override public Enum apply(@Nullable String input, Type runtimeOutputType) { if (input == null) { return null; } Class rawType = TypeToken.of(runtimeOutputType).getRawType(); Enum r = Enum.valueOf(rawType, input); return r; } }
StringToEnumFunction implements RuntimeSetterFunction<String, Enum> { @Nullable @Override public Enum apply(@Nullable String input, Type runtimeOutputType) { if (input == null) { return null; } Class rawType = TypeToken.of(runtimeOutputType).getRawType(); Enum r = Enum.valueOf(rawType, input); return r; }  }
StringToEnumFunction implements RuntimeSetterFunction<String, Enum> { @Nullable @Override public Enum apply(@Nullable String input, Type runtimeOutputType) { if (input == null) { return null; } Class rawType = TypeToken.of(runtimeOutputType).getRawType(); Enum r = Enum.valueOf(rawType, input); return r; }  @Nullable @Override Enum apply(@Nullable String input, Type runtimeOutputType); }
StringToEnumFunction implements RuntimeSetterFunction<String, Enum> { @Nullable @Override public Enum apply(@Nullable String input, Type runtimeOutputType) { if (input == null) { return null; } Class rawType = TypeToken.of(runtimeOutputType).getRawType(); Enum r = Enum.valueOf(rawType, input); return r; }  @Nullable @Override Enum apply(@Nullable String input, Type runtimeOutputType);  }