@Test(expected = TypeConverterException.class) public void testValidateFail() throws Exception { typeConverter.validate(Long.TYPE, 2, -1); }
@Override public void validate(Class<?> type, int size, int decimal) { if(size > 9) { throw new TypeConverterException("int is not large enough to hold possible value"); } if(!(Integer.class.equals(type) || Integer.TYPE.equals(type))) { throw new TypeConverterException("Only supports converting to and from int or Integer"); } }
IntegerToInteger extends TypeConverterBase { @Override public void validate(Class<?> type, int size, int decimal) { if(size > 9) { throw new TypeConverterException("int is not large enough to hold possible value"); } if(!(Integer.class.equals(type) || Integer.TYPE.equals(type))) { throw new TypeConverterException("Only supports converting to and from int or Integer"); } } }
IntegerToInteger extends TypeConverterBase { @Override public void validate(Class<?> type, int size, int decimal) { if(size > 9) { throw new TypeConverterException("int is not large enough to hold possible value"); } if(!(Integer.class.equals(type) || Integer.TYPE.equals(type))) { throw new TypeConverterException("Only supports converting to and from int or Integer"); } }  }
IntegerToInteger extends TypeConverterBase { @Override public void validate(Class<?> type, int size, int decimal) { if(size > 9) { throw new TypeConverterException("int is not large enough to hold possible value"); } if(!(Integer.class.equals(type) || Integer.TYPE.equals(type))) { throw new TypeConverterException("Only supports converting to and from int or Integer"); } }  @Override void validate(Class<?> type, int size, int decimal); @Override Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding); }
IntegerToInteger extends TypeConverterBase { @Override public void validate(Class<?> type, int size, int decimal) { if(size > 9) { throw new TypeConverterException("int is not large enough to hold possible value"); } if(!(Integer.class.equals(type) || Integer.TYPE.equals(type))) { throw new TypeConverterException("Only supports converting to and from int or Integer"); } }  @Override void validate(Class<?> type, int size, int decimal); @Override Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding);  }