StringToBoolean 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(values[0].equals(value)) { return true; } else if(values[1].equals(value)) { return false; } else { throw new TypeConverterException("Unknown true or false value: " + value); } }  @Override void initialize(TypeConverterConfig config); @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);  }
@Test public void testTo() throws Exception { assertEquals(false, typeConverter.to("N".getBytes(StandardCharsets.UTF_8), 0, 1, -1, true)); assertEquals(true, typeConverter.to("Y".getBytes(StandardCharsets.UTF_8), 0, 1, -1, true)); }