registerSubtypes takes an array of NamedTypes:
@Override
public void registerSubtypes(NamedType... types) {
if (_registeredSubtypes == null) {
_registeredSubtypes = new LinkedHashSet<NamedType>();
}
for (NamedType type : types) {
_registeredSubtypes.add(type);
}
}
But unfortunately, if I want to register the same POJO for several types (let's say the JSONs only differ on their type field), it will only register the first one because they are added to a LinkedHashSet and NamedType doesn't include name field in equals/hashcode.
I don't even create a subtype of NamedType to override equals/hashcode because the class it final.
Would it make sense to care about NamedType.name field ?