@Override public Object toObject(String value) { if (value == null || value.length() == 0) { return null; } try { Short b = Short.parseShort(value); if (b.shortValue() < 0) { throw newIllegalDataException("Value may not be negative(" + b + ")"); } return b; } catch (NumberFormatException e) { throw newIllegalDataException(e); } }
@Override public byte[] toBytes(Object object) { if (object == null) { throw newIllegalDataException(this + " may not be null"); } byte[] b = new byte[Bytes.SIZEOF_SHORT]; toBytes(object, b, 0); return b; }
@Override public int toBytes(Object object, byte[] bytes, int offset) { if (object == null) { throw newIllegalDataException(this + " may not be null"); } return this.getCodec().encodeShort(((Number) object).shortValue(), bytes, offset); }
@Override public Object toObject(String value) { if (value == null || value.length() == 0) { return null; } try { Short b = Short.parseShort(value); if (b.shortValue() < 0) { throw newIllegalDataException("Value may not be negative(" + b + ")"); } return b; } catch (NumberFormatException e) { throw newIllegalDataException(e); } }
@Override public Object toObject(String value) { if (value == null || value.length() == 0) { return null; } try { Short b = Short.parseShort(value); if (b.shortValue() < 0) { throw newIllegalDataException("Value may not be negative(" + b + ")"); } return b; } catch (NumberFormatException e) { throw newIllegalDataException(e); } }
@Override public byte[] toBytes(Object object) { if (object == null) { throw newIllegalDataException(this + " may not be null"); } byte[] b = new byte[Bytes.SIZEOF_SHORT]; toBytes(object, b, 0); return b; }
@Override public byte[] toBytes(Object object) { if (object == null) { throw newIllegalDataException(this + " may not be null"); } byte[] b = new byte[Bytes.SIZEOF_SHORT]; toBytes(object, b, 0); return b; }
@Override public int toBytes(Object object, byte[] bytes, int offset) { if (object == null) { throw newIllegalDataException(this + " may not be null"); } return this.getCodec().encodeShort(((Number) object).shortValue(), bytes, offset); }
@Override public int toBytes(Object object, byte[] bytes, int offset) { if (object == null) { throw newIllegalDataException(this + " may not be null"); } return this.getCodec().encodeShort(((Number) object).shortValue(), bytes, offset); }