@Test public void testToZeroValue() throws Exception { assertEquals(0, (long)typeConverter.to("0000000000".getBytes(StandardCharsets.UTF_8), 0, 10, -1, 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);  }