@Test public void testToNullDefaultValue() throws Exception { config.setNullFillerChar((char)0); config.setDefaultValue("MM"); typeConverter.initialize(config); assertEquals(TestStringEnum.MEDIUM, typeConverter.to(new byte[4], 0, 2, 2, true)); }
@Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { String value = (String)super.to(bytes, offset, length, decimals, removePadding); if (toEnumMap.containsKey(value)) { return toEnumMap.get(value); } else { throw new TypeConverterException("Unknown value for enum: " + value); } }
StringToTypeConverterStringEnum extends StringToString { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { String value = (String)super.to(bytes, offset, length, decimals, removePadding); if (toEnumMap.containsKey(value)) { return toEnumMap.get(value); } else { throw new TypeConverterException("Unknown value for enum: " + value); } } }
StringToTypeConverterStringEnum extends StringToString { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { String value = (String)super.to(bytes, offset, length, decimals, removePadding); if (toEnumMap.containsKey(value)) { return toEnumMap.get(value); } else { throw new TypeConverterException("Unknown value for enum: " + value); } }  }
StringToTypeConverterStringEnum extends StringToString { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { String value = (String)super.to(bytes, offset, length, decimals, removePadding); if (toEnumMap.containsKey(value)) { return toEnumMap.get(value); } else { throw new TypeConverterException("Unknown value for enum: " + value); } }  @Override void validate(Class<?> type, int size, int decimals); @Override Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding); }
StringToTypeConverterStringEnum extends StringToString { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { String value = (String)super.to(bytes, offset, length, decimals, removePadding); if (toEnumMap.containsKey(value)) { return toEnumMap.get(value); } else { throw new TypeConverterException("Unknown value for enum: " + value); } }  @Override void validate(Class<?> type, int size, int decimals); @Override Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding);  }