@Test public void testToProperty() throws Exception { EnumConverter<Encoding> converter = new EnumConverter<Encoding>( new Foo().enumP); assertEquals(Encoding.UTF_8, converter.fromString("UTF_8")); }
@SuppressWarnings("unchecked") @Override public E fromString(String string) throws ConverterException { Class<E> type = (Class<E>) property.meta().type; try { return Enum.valueOf(type, string); } catch (IllegalArgumentException ex) { if (resId == -1) { throw ex; } else { throw new ConverterException(resId); } } }
EnumConverter implements Converter<E> { @SuppressWarnings("unchecked") @Override public E fromString(String string) throws ConverterException { Class<E> type = (Class<E>) property.meta().type; try { return Enum.valueOf(type, string); } catch (IllegalArgumentException ex) { if (resId == -1) { throw ex; } else { throw new ConverterException(resId); } } } }
EnumConverter implements Converter<E> { @SuppressWarnings("unchecked") @Override public E fromString(String string) throws ConverterException { Class<E> type = (Class<E>) property.meta().type; try { return Enum.valueOf(type, string); } catch (IllegalArgumentException ex) { if (resId == -1) { throw ex; } else { throw new ConverterException(resId); } } } EnumConverter(Property<E> property);  EnumConverter(Property<E> property, int resId); }
EnumConverter implements Converter<E> { @SuppressWarnings("unchecked") @Override public E fromString(String string) throws ConverterException { Class<E> type = (Class<E>) property.meta().type; try { return Enum.valueOf(type, string); } catch (IllegalArgumentException ex) { if (resId == -1) { throw ex; } else { throw new ConverterException(resId); } } } EnumConverter(Property<E> property);  EnumConverter(Property<E> property, int resId); String toString(E value); @SuppressWarnings("unchecked") @Override E fromString(String string); }
EnumConverter implements Converter<E> { @SuppressWarnings("unchecked") @Override public E fromString(String string) throws ConverterException { Class<E> type = (Class<E>) property.meta().type; try { return Enum.valueOf(type, string); } catch (IllegalArgumentException ex) { if (resId == -1) { throw ex; } else { throw new ConverterException(resId); } } } EnumConverter(Property<E> property);  EnumConverter(Property<E> property, int resId); String toString(E value); @SuppressWarnings("unchecked") @Override E fromString(String string);  }