final boolean hasKey = key != null;
writer.writeBoolean("key", hasKey);
if (predicate == null) {
writer.writeBoolean("pre", false);
if (hasKey) {
final ObjectDataOutput out = writer.getRawDataOutput();
key.writeData(out);
}
} else {
writer.writeBoolean("pre", true);
writer.writeUTF("p", predicate);
final ObjectDataOutput out = writer.getRawDataOutput();
if (hasKey) {
key.writeData(out);
}
}