@Override public void write(ObjectDataOutput out, DataSerializable obj) throws IOException { // If you ever change the way this is serialized think about to change // BasicOperationService::extractOperationCallId setOutputVersion(out, version); final boolean identified = obj instanceof IdentifiedDataSerializable; out.writeBoolean(identified); if (identified) { final IdentifiedDataSerializable ds = (IdentifiedDataSerializable) obj; out.writeInt(ds.getFactoryId()); out.writeInt(ds.getId()); } else { if (obj instanceof TypedDataSerializable) { out.writeUTF(((TypedDataSerializable) obj).getClassType().getName()); } else { out.writeUTF(obj.getClass().getName()); } } obj.writeData(out); }
@Override public void write(ObjectDataOutput out, DataSerializable obj) throws IOException { // If you ever change the way this is serialized think about to change // BasicOperationService::extractOperationCallId setOutputVersion(out, version); final boolean identified = obj instanceof IdentifiedDataSerializable; out.writeBoolean(identified); if (identified) { final IdentifiedDataSerializable ds = (IdentifiedDataSerializable) obj; out.writeInt(ds.getFactoryId()); out.writeInt(ds.getId()); } else { if (obj instanceof TypedDataSerializable) { out.writeUTF(((TypedDataSerializable) obj).getClassType().getName()); } else { out.writeUTF(obj.getClass().getName()); } } obj.writeData(out); }