public void putToBuffer(ByteBuffer buffer) { buffer.put(requestType.getCode()); buffer.put(errorCode.getCode()); buffer.putInt(sku); buffer.putShort(store); buffer.putInt(amount); }
@Override public int hashCode() { int result = requestType.hashCode(); result = 31 * result + errorCode.hashCode(); result = 31 * result + sku; result = 31 * result + (int) store; result = 31 * result + amount; return result; }
public static BinaryResponse fromByteBuffer(ByteBuffer buffer) { BinaryRequestType requestType = BinaryRequestType.getByCode(buffer.get()); BinaryErrorCodes errorCode = BinaryErrorCodes.getByCode(buffer.get()); int sku = buffer.getInt(); short store = buffer.getShort(); int amount = buffer.getInt(); return new BinaryResponse(requestType, errorCode, sku, store, amount); }