@Override public Link read(DataInput dataInput) { // Read the encoding version byte, but ignore it for the moment since there is only one encoding byte version = dataInput.readByte(); Link link; switch (version) { case VERSION_ONE: link = Lily11RecordIdDecoder.decodeLink(dataInput, idGenerator); break; case VERSION_TWO: link = Lily20LinkDecoder.decode(dataInput, idGenerator); break; case VERSION_THREE: link = Link.read(dataInput, idGenerator); break; default: throw new RuntimeException("Unsupported encoding version for link value type: " + version); } return link; }