- private void writeObject(final java.io.ObjectOutputStream out) throws IOException {
- out.defaultWriteObject();
- out.writeInt(Iterables.size(pathArguments));
- for (Object o : pathArguments) {
- out.writeObject(o);
- }
- }
-
- private void readObject(final java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
- in.defaultReadObject();
-
- final int size = in.readInt();
- final List<PathArgument> args = new ArrayList<>(size);
- for (int i = 0; i < size; ++i) {
- args.add((PathArgument) in.readObject());
- }
-
- try {
- PATHARGUMENTS_FIELD.set(this, ImmutableList.copyOf(args));
- } catch (IllegalArgumentException | IllegalAccessException e) {
- throw new IOException(e);
- }
+ private Object writeReplace() throws ObjectStreamException {
+ return new InstanceIdentifierV3<>(this);