[infinispan-dev] Generalizing Externalizer interface
Galder Zamarreño
galder at redhat.com
Mon Nov 29 10:32:28 EST 2010
As part of https://jira.jboss.org/browse/ISPN-246, we're gonna be making Externalizer interface (http://docs.jboss.org/infinispan/4.2/apidocs/org/infinispan/marshall/Externalizer.html) even more public allowing users to provide their own externalizer implementations.
I had a brief scan and it seems like (or so should be unless it's a very strange externalizer), that all Externalizers are symmetric. IOW, whatever type the writeObject() object is passed, that's the type we return in readObject(). So, I was thinking of generalizing Externalizer to look something like this:
interface Externalizer<T> {
void writeObject(ObjectOutput output, T object) throws IOException;
T readObject(ObjectInput input) throws IOException, ClassNotFoundException;
}
Does anyone have any objections? This would safe a lot of casting in implementations, making externalizers easier to code and type safer.
Cheers,
p.s. This would only be included in 5.x.
--
Galder Zamarreño
Sr. Software Engineer
Infinispan, JBoss Cache
More information about the infinispan-dev
mailing list