@Test public void testToDisplayOfAnEnumUsesHumanizedOutput() { ListBoxIdentityAdaptor<Color> a = new ListBoxIdentityAdaptor<Color>(); assertThat(a.toDisplay(Color.GREEN), is("Green")); assertThat(a.toDisplay(Color.BLUE), is("Blue (not green)")); }
@Override public String toDisplay(P option) { if (option instanceof Enum<?> && ((Enum<?>) option).name().equals(option.toString())) { return Inflector.humanize(option.toString()); } return option == null ? nullText : option.toString(); }
ListBoxIdentityAdaptor implements ListBoxAdaptor<P, P> { @Override public String toDisplay(P option) { if (option instanceof Enum<?> && ((Enum<?>) option).name().equals(option.toString())) { return Inflector.humanize(option.toString()); } return option == null ? nullText : option.toString(); } }
ListBoxIdentityAdaptor implements ListBoxAdaptor<P, P> { @Override public String toDisplay(P option) { if (option instanceof Enum<?> && ((Enum<?>) option).name().equals(option.toString())) { return Inflector.humanize(option.toString()); } return option == null ? nullText : option.toString(); } ListBoxIdentityAdaptor();  ListBoxIdentityAdaptor(String nullText); }
ListBoxIdentityAdaptor implements ListBoxAdaptor<P, P> { @Override public String toDisplay(P option) { if (option instanceof Enum<?> && ((Enum<?>) option).name().equals(option.toString())) { return Inflector.humanize(option.toString()); } return option == null ? nullText : option.toString(); } ListBoxIdentityAdaptor();  ListBoxIdentityAdaptor(String nullText); @Override String toDisplay(P option); @Override P toValue(P option); }
ListBoxIdentityAdaptor implements ListBoxAdaptor<P, P> { @Override public String toDisplay(P option) { if (option instanceof Enum<?> && ((Enum<?>) option).name().equals(option.toString())) { return Inflector.humanize(option.toString()); } return option == null ? nullText : option.toString(); } ListBoxIdentityAdaptor();  ListBoxIdentityAdaptor(String nullText); @Override String toDisplay(P option); @Override P toValue(P option);  }