Good to know I am not going crazy.
While I think supporting constructor annotation inheritance would be useful, I did some extra work and realized that StdDelegatingDeserializer is a better approach, as I am converting my Domain objects to and from Map<String,Object> anyway. Working through that, I ran into the fact that SimpleDeserializers looks up matches via the _classMappings attribute. And it does so by exact class matching, rather than by class inheritance. So I'd still have to register my single instance of StdDelegatingDeserializer individually for a few thousand classes.
The better implementation for me would be to modify the _classMappings lookup to match on the entire class hierarchy for a ClassKey.I.e., try to match on class "A", then match on class A's superclass "B", the superclass "C", etc.
Cleanest way to make that change would be a subclass of HashMap<ClassKey,JsonDeserializer<?>> that overrides the get() method. Unfortunately the ClassKey._class attribute is private, so walking up the class hierarchy is an ugly "new ClassKey(Class.forName(classKey.toString()).superClass())" codewart. (And obviously, overriding a HashMap class isn't exactly a "best practice". :)
I'd suggest that the following line in SimpleDeserializers be refactored out into a separate method, which can then be overridden cleanly::
return (_classMappings == null) ? null : _classMappings.get(new ClassKey(type.getRawClass()));
In the meantime, I just subclassed SimpleDeserializers and overrode the 8 find... methods to walk up the class hierarchy.
This ...... almost ..... worked ....
I had the following:
-------------
SimpleModule module = new SimpleModule("MyData", Version.unknownVersion());
module.setDeserializers(new HierarchicalDeserializers()); //HierarchicalDeserializers is my subclass of SimplerDeserializers
module.addDeserializer(MyData.class, new StdDelegatingDeserializer<MyData>(new StdConverter<Map<?,?>, MyData>() {
@Override public MyData convert(Map<?,?> map) {
//handle instance construction and population;
}
}));
The problem is that the map argument to the StdConverter.convert() does NOT contain any information about the particular subclass. IOW, it has all the attributes, but not the "@class" parameter with the classname. Not that I expected it would, but some type information passed along as a method parameter would have been perfect. Oh well...
--------
I spent the day struggling through the various factories and things. Finally decided to do a lazy instantiation of an StdDelegatingDeserializer inner class for each requested subclass of MyData. I pass the class in through the constructor, so the instance always know what subclass it is dealing with.