/** * Main serializer constructor method. The base implementation within * this class first calls a fast lookup method that can find serializers * for well-known JDK classes; and if that fails, a slower one that * tries to check out which interfaces given Class implements. * Sub-classes can (and do) change this behavior to alter behavior. */ @Override @SuppressWarnings("unchecked") public <T> JsonSerializer<T> createSerializer(Class<T> type, SerializationConfig config) { // First, fast lookup for exact type: JsonSerializer<?> ser = findSerializerByLookup(type, config); if (ser == null) { /* and should that fail, slower introspection methods; first * one that deals with "primary" types */ ser = findSerializerByPrimaryType(type, config); if (ser == null) { // And if that fails, one with "secondary" traits: ser = findSerializerByAddonType(type, config); } } return (JsonSerializer<T>) ser; }
if (ser == null) { ser = super.findSerializerByPrimaryType(type, config); if (ser == null) {