@Test public void testApply() throws Exception { A a = new A(); Method m = A.class.getDeclaredMethod("setX", String[].class); SetterInvoker invoker = FunctionalSetterInvoker.create("x", m); invoker.invoke(a, "1,2,3"); assertThat(Arrays.toString(a.getX()), is(Arrays.toString(new String[]{"1", "2", "3"}))); invoker.invoke(a, null); assertThat(a.getX(), nullValue()); invoker.invoke(a, ""); assertThat(Arrays.toString(a.getX()), is(Arrays.toString(new String[]{}))); }
@Nullable @Override public String[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new String[0]; } return input.split(SEPARATOR); }
StringToStringArrayFunction implements SetterFunction<String, String[]> { @Nullable @Override public String[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new String[0]; } return input.split(SEPARATOR); } }
StringToStringArrayFunction implements SetterFunction<String, String[]> { @Nullable @Override public String[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new String[0]; } return input.split(SEPARATOR); }  }
StringToStringArrayFunction implements SetterFunction<String, String[]> { @Nullable @Override public String[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new String[0]; } return input.split(SEPARATOR); }  @Nullable @Override String[] apply(@Nullable String input); }
StringToStringArrayFunction implements SetterFunction<String, String[]> { @Nullable @Override public String[] apply(@Nullable String input) { if (input == null) { return null; } if (input.length() == 0) { return new String[0]; } return input.split(SEPARATOR); }  @Nullable @Override String[] apply(@Nullable String input);  }