@Test public void testToNullDefaultValue() throws Exception { config.setNullFillerChar((char)0); config.setDefaultValue("42"); typeConverter.initialize(config); assertEquals(42, (long)typeConverter.to(new byte[4], 0, 2, 2, true)); }
@Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return Long.parseLong(defaultValue); } else { return Long.parseLong(getIntegerString(bytes, offset, length, removePadding)); } }
IntegerToLong extends IntegerToInteger { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return Long.parseLong(defaultValue); } else { return Long.parseLong(getIntegerString(bytes, offset, length, removePadding)); } } }
IntegerToLong extends IntegerToInteger { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return Long.parseLong(defaultValue); } else { return Long.parseLong(getIntegerString(bytes, offset, length, removePadding)); } }  }
IntegerToLong extends IntegerToInteger { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return Long.parseLong(defaultValue); } else { return Long.parseLong(getIntegerString(bytes, offset, length, removePadding)); } }  @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); }
IntegerToLong extends IntegerToInteger { @Override public Object to(byte[] bytes, int offset, int length, int decimals, boolean removePadding) { if(this.defaultValue != null && ByteUtils.allEquals(bytes, this.nullFillerByte, offset, bytes.length)) { return Long.parseLong(defaultValue); } else { return Long.parseLong(getIntegerString(bytes, offset, length, removePadding)); } }  @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);  }