Source:
public ObjectStrategy getObjectStrategy() { return new ObjectStrategy<SerializablePairLongString>() { @Override public int compare(SerializablePairLongString o1, SerializablePairLongString o2) { int comparation; if (o1 == null && o2 == null) { comparation = 0; } else if (o1 == null) { comparation = -1; } else if (o2 == null) { comparation = 1; } else { comparation = o1.lhs.compareTo(o2.lhs); if (comparation == 0) { if (o1.rhs == null && o2.rhs == null) { comparation = 0; } else if (o1.rhs == null) { comparation = -1; } else if (o2.rhs == null) { comparation = 1; } else { comparation = o1.rhs.compareTo(o2.rhs); } } } return comparation; } @Override public Class<? extends SerializablePairLongString> getClazz() { return SerializablePairLongString.class; } @Override public SerializablePairLongString fromByteBuffer(ByteBuffer buffer, int numBytes) { final ByteBuffer readOnlyBuffer = buffer.asReadOnlyBuffer(); Long lhs = readOnlyBuffer.getLong(); Integer stringSize = readOnlyBuffer.getInt(); String lastString = null; if (stringSize > 0) { byte[] stringBytes = new byte[stringSize]; readOnlyBuffer.get(stringBytes, 0, stringSize); lastString = StringUtils.fromUtf8(stringBytes); } return new SerializablePairLongString(lhs, lastString); } @Override public byte[] toBytes(SerializablePairLongString val) { String rhsString = val.rhs; ByteBuffer bbuf; if (rhsString != null) { byte[] rhsBytes = StringUtils.toUtf8(rhsString); bbuf = ByteBuffer.allocate(Long.BYTES + Integer.BYTES + rhsBytes.length); bbuf.putLong(val.lhs); bbuf.putInt(Long.BYTES, rhsBytes.length); bbuf.position(Long.BYTES + Integer.BYTES); bbuf.put(rhsBytes); } else { bbuf = ByteBuffer.allocate(Long.BYTES + Integer.BYTES); bbuf.putLong(val.lhs); bbuf.putInt(Long.BYTES, 0); } return bbuf.array(); } }; }

Target:
public ObjectStrategy getObjectStrategy() { return new ObjectStrategy<SerializablePairLongString>() { @Override public int compare(@Nullable SerializablePairLongString o1, @Nullable SerializablePairLongString o2) { return StringFirstAggregatorFactory.VALUE_COMPARATOR.compare(o1, o2); } @Override public Class<? extends SerializablePairLongString> getClazz() { return SerializablePairLongString.class; } @Override public SerializablePairLongString fromByteBuffer(ByteBuffer buffer, int numBytes) { final ByteBuffer readOnlyBuffer = buffer.asReadOnlyBuffer(); long lhs = readOnlyBuffer.getLong(); int stringSize = readOnlyBuffer.getInt(); String lastString = null; if (stringSize > 0) { byte[] stringBytes = new byte[stringSize]; readOnlyBuffer.get(stringBytes, 0, stringSize); lastString = StringUtils.fromUtf8(stringBytes); } return new SerializablePairLongString(lhs, lastString); } @Override public byte[] toBytes(SerializablePairLongString val) { String rhsString = val.rhs; ByteBuffer bbuf; if (rhsString != null) { byte[] rhsBytes = StringUtils.toUtf8(rhsString); bbuf = ByteBuffer.allocate(Long.BYTES + Integer.BYTES + rhsBytes.length); bbuf.putLong(val.lhs); bbuf.putInt(Long.BYTES, rhsBytes.length); bbuf.position(Long.BYTES + Integer.BYTES); bbuf.put(rhsBytes); } else { bbuf = ByteBuffer.allocate(Long.BYTES + Integer.BYTES); bbuf.putLong(val.lhs); bbuf.putInt(Long.BYTES, 0); } return bbuf.array(); } }; }