com.fasterxml.jackson.databind.ser.impl

## Class PropertySerializerMap

- java.lang.Object
- - com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap

-     public abstract class PropertySerializerMap
      extends Object

  Helper container used for resolving serializers for dynamic (possibly but not necessarily polymorphic) properties: properties whose type is not forced to use dynamic (declared) type and that are not final. If so, serializer to use can only be established once actual value type is known. Since this happens a lot unless static typing is forced (or types are final) this implementation is optimized for efficiency. Instances are immutable; new instances are created with factory methods: this is important to ensure correct multi-threaded access.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `PropertySerializerMap.SerializerAndMapResult` Value class used for returning tuple that has both serializer that was retrieved and new map instance

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PropertySerializerMap()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PropertySerializerMap` | `emptyMap()`
    `PropertySerializerMap.SerializerAndMapResult` | `findAndAddPrimarySerializer(Class<?> type, SerializerProvider provider, BeanProperty property)` Method called if initial lookup fails, when looking for a primary serializer (one that is directly attached to a property).
    `PropertySerializerMap.SerializerAndMapResult` | `findAndAddPrimarySerializer(JavaType type, SerializerProvider provider, BeanProperty property)`
    `PropertySerializerMap.SerializerAndMapResult` | `findAndAddSecondarySerializer(Class<?> type, SerializerProvider provider, BeanProperty property)` Method called if initial lookup fails, when looking for a non-primary serializer (one that is not directly attached to a property).
    `PropertySerializerMap.SerializerAndMapResult` | `findAndAddSecondarySerializer(JavaType type, SerializerProvider provider, BeanProperty property)`
    `PropertySerializerMap.SerializerAndMapResult` | `findAndAddSerializer(Class<?> type, SerializerProvider provider, BeanProperty property)` Deprecated. Since 2.3; use either `findAndAddPrimarySerializer` or `findAndAddSecondarySerializer`. To be removed from 2.4
    `PropertySerializerMap.SerializerAndMapResult` | `findAndAddSerializer(JavaType type, SerializerProvider provider, BeanProperty property)` Deprecated. Since 2.3; use either `findAndAddPrimarySerializer` or `findAndAddSecondarySerializer`. To be removed from 2.4
    `abstract PropertySerializerMap` | `newWith(Class<?> type, JsonSerializer<Object> serializer)`
    `abstract JsonSerializer<Object>` | `serializerFor(Class<?> type)` Main lookup method.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PropertySerializerMap

          public PropertySerializerMap()

  - ### Method Detail

    - #### serializerFor

          public abstract JsonSerializer<Object> serializerFor(Class<?> type)

      Main lookup method. Takes a "raw" type since usage is always from place where parameterization is fixed such that there can not be type-parametric variations.

    - #### findAndAddSerializer

          @Deprecated
          public final PropertySerializerMap.SerializerAndMapResult findAndAddSerializer(Class<?> type,
                                                                                     SerializerProvider provider,
                                                                                     BeanProperty property)
                                                                                  throws JsonMappingException

      Deprecated. Since 2.3; use either `findAndAddPrimarySerializer` or `findAndAddSecondarySerializer`. To be removed from 2.4
      Throws:
        `JsonMappingException`

    - #### findAndAddSerializer

          @Deprecated
          public final PropertySerializerMap.SerializerAndMapResult findAndAddSerializer(JavaType type,
                                                                                     SerializerProvider provider,
                                                                                     BeanProperty property)
                                                                                  throws JsonMappingException

      Deprecated. Since 2.3; use either `findAndAddPrimarySerializer` or `findAndAddSecondarySerializer`. To be removed from 2.4
      Throws:
        `JsonMappingException`

    - #### findAndAddPrimarySerializer

          public final PropertySerializerMap.SerializerAndMapResult findAndAddPrimarySerializer(Class<?> type,
                                                                                 SerializerProvider provider,
                                                                                 BeanProperty property)
                                                                                         throws JsonMappingException

      Method called if initial lookup fails, when looking for a primary serializer (one that is directly attached to a property). Will both find serializer and construct new map instance if warranted, and return both.
      Throws:
        `JsonMappingException`
      Since:
        2.3

    - #### findAndAddPrimarySerializer

          public final PropertySerializerMap.SerializerAndMapResult findAndAddPrimarySerializer(JavaType type,
                                                                                 SerializerProvider provider,
                                                                                 BeanProperty property)
                                                                                         throws JsonMappingException

      Throws:
        `JsonMappingException`

    - #### findAndAddSecondarySerializer

          public final PropertySerializerMap.SerializerAndMapResult findAndAddSecondarySerializer(Class<?> type,
                                                                                   SerializerProvider provider,
                                                                                   BeanProperty property)
                                                                                           throws JsonMappingException

      Method called if initial lookup fails, when looking for a non-primary serializer (one that is not directly attached to a property). Will both find serializer and construct new map instance if warranted, and return both.
      Throws:
        `JsonMappingException`
      Since:
        2.3

    - #### findAndAddSecondarySerializer

          public final PropertySerializerMap.SerializerAndMapResult findAndAddSecondarySerializer(JavaType type,
                                                                                   SerializerProvider provider,
                                                                                   BeanProperty property)
                                                                                           throws JsonMappingException

      Throws:
        `JsonMappingException`

    - #### newWith

          public abstract PropertySerializerMap newWith(Class<?> type,
                                      JsonSerializer<Object> serializer)

    - #### emptyMap

          public static PropertySerializerMap emptyMap()

Copyright © 2012-2013 FasterXML. All Rights Reserved.