NumberConverter implements Converter<N> { @Override public String toString(N value) { if (value == null) { return ""; } return format.format(value); } NumberConverter(Property<N> property, int resId); @Override String toString(N value); @SuppressWarnings("unchecked") @Override N fromString(String string);  }
@Test public void testFromProperty() throws Exception { assertEquals("0", converter(new Foo().byteP).toString((byte) 0)); assertEquals("0", converter(new Foo().shortP).toString((short) 0)); assertEquals("0", converter(new Foo().intP).toString((int) 0)); assertEquals("0", converter(new Foo().longP).toString((long) 0)); assertEquals("0", converter(new Foo().floatP).toString((float) 0)); assertEquals("0", converter(new Foo().doubleP).toString((double) 0)); assertEquals("", converter(new Foo().doubleP).toString(null)); }