public Serializer getDefaultSerializer ( Class type ) { if ( type == null ) throw new IllegalArgumentException ( "type cannot be null." ) ; Serializer serializerForAnnotation = getDefaultSerializerForAnnotatedType ( type ) ; if ( serializerForAnnotation != null ) return serializerForAnnotation ; for ( int i = 0 , n = defaultSerializers . size ( ) ; i < n ; i ++ ) { DefaultSerializerEntry entry = defaultSerializers . get ( i ) ; if ( entry . type . isAssignableFrom ( type ) && entry . serializerFactory . isSupported ( type ) ) return entry . serializerFactory . newSerializer ( this , type ) ; } return newDefaultSerializer ( type ) ; }
Returns the best matching serializer for a class . This method can be overridden to implement custom logic to choose a serializer .