@Test public void testToNullDefaultValue() throws Exception { config.setNullFillerChar((char)0); config.setDefaultValue("42"); typeConverter.initialize(config); assertEquals(new BigInteger("42"), typeConverter.to(new byte[4], 0, 2, 2, true)); }
@Override public BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return new BigInteger(defaultValue); } else { return new BigInteger(getIntegerString(bytes, offset, length, removePadding)); } }
IntegerToBigInteger extends IntegerToInteger { @Override public BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return new BigInteger(defaultValue); } else { return new BigInteger(getIntegerString(bytes, offset, length, removePadding)); } } }
IntegerToBigInteger extends IntegerToInteger { @Override public BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return new BigInteger(defaultValue); } else { return new BigInteger(getIntegerString(bytes, offset, length, removePadding)); } }  }
IntegerToBigInteger extends IntegerToInteger { @Override public BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return new BigInteger(defaultValue); } else { return new BigInteger(getIntegerString(bytes, offset, length, removePadding)); } }  @Override void validate(Class<?> type, int size, int decimals); @Override BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding); }
IntegerToBigInteger extends IntegerToInteger { @Override public BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return new BigInteger(defaultValue); } else { return new BigInteger(getIntegerString(bytes, offset, length, removePadding)); } }  @Override void validate(Class<?> type, int size, int decimals); @Override BigInteger to(byte[] bytes, int offset, int length, int decimals, boolean removePadding); @Override byte[] from(Object value, int length, int decimals, boolean addPadding);  }