On Mon, Sep 13, 2010 at 9:35 PM, Ted Dunning <[email protected]> wrote: > BUT... there is one possible role for sub-classes of VectorWritable. That > would be to avoid the otherwise necessary cast > of the object that is produced by the VectorWritable. Thus a > MumbleVectorWritable would delegate all reading to VectorWritable > but would cast the result to a MumbleVector before returning it. That cast > would fail if the objects being read don't sub-class > MumbleVector and the user code would not need a cast.
It's possible. The implementation-specific Writable saves you cast -- but yes internally it is probably just doing a cast of the result from VectorWritable. You could save this cast with a generic type on VectorWritable too. While it might be abusing the meaning of generics a little, it would serve a practical purpose. No subclasses needed.
