private final AdvancedExternalizer idViaAnnotationObjExt = new IdViaAnnotationObj.Externalizer();
private final AdvancedExternalizer idViaBothObjExt = new IdViaBothObj.Externalizer();
@Override
public void writeObject(ObjectOutput output, Object object) throws IOException {
AdvancedExternalizer ext;
if (object instanceof IdViaConfigObj) {
output.write(0);
ext = idViaConfigObjExt;
} else if (object instanceof IdViaAnnotationObj) {
output.write(1);
ext = idViaAnnotationObjExt;
} else if (object instanceof IdViaBothObj){
output.write(2);
ext = idViaBothObjExt;
} else {
throw new CacheException(String.format(
"Object of type %s is not supported by externalizer %s",
object.getClass().getName(), this.getClass().getName()));
}
ext.writeObject(output, object);
}