/**
  * Method called to get the serializer to use for serializing non-null Map keys. Separation from
  * regular {@link #findValueSerializer} method is because actual write method must be different
  * (@link JsonGenerator#writeFieldName}; but also since behavior for some key types may differ.
  *
  * <p>Note that the serializer itself can be called with instances of any Java object, but not
  * nulls.
  */
 public JsonSerializer<Object> findKeySerializer(JavaType keyType, BeanProperty property)
     throws JsonMappingException {
   JsonSerializer<Object> ser =
       _serializerFactory.createKeySerializer(_config, keyType, _keySerializer);
   // 25-Feb-2011, tatu: As per [JACKSON-519], need to ensure contextuality works here, too
   return _handleContextualResolvable(ser, property);
 }
  /**
   * Method called to locate regular serializer, matching type serializer, and if both found, wrap
   * them in a serializer that calls both in correct sequence. This method is currently only used
   * for root-level serializer handling to allow for simpler caching. A call can always be replaced
   * by equivalent calls to access serializer and type serializer separately.
   *
   * @param valueType Declared type of value being serialized (which may not be actual runtime
   *     type); used for finding both value serializer and type serializer to use for adding
   *     polymorphic type (if any)
   * @param cache Whether resulting value serializer should be cached or not; this is just a hint
   * @param property When creating secondary serializers, property for which serializer is needed:
   *     annotations of the property (or bean that contains it) may be checked to create contextual
   *     serializers.
   */
  public JsonSerializer<Object> findTypedValueSerializer(
      JavaType valueType, boolean cache, BeanProperty property) throws JsonMappingException {
    // Two-phase lookups; local non-shared cache, then shared:
    JsonSerializer<Object> ser = _knownSerializers.typedValueSerializer(valueType);
    if (ser != null) {
      return ser;
    }
    // If not, maybe shared map already has it?
    ser = _serializerCache.typedValueSerializer(valueType);
    if (ser != null) {
      return ser;
    }

    // Well, let's just compose from pieces:
    ser = findValueSerializer(valueType, property);
    TypeSerializer typeSer = _serializerFactory.createTypeSerializer(_config, valueType);
    if (typeSer != null) {
      typeSer = typeSer.forProperty(property);
      ser = new TypeWrappedSerializer(typeSer, ser);
    }
    if (cache) {
      _serializerCache.addTypedSerializer(valueType, ser);
    }
    return ser;
  }
 /** @since 2.1 */
 protected JsonSerializer<Object> _createUntypedSerializer(JavaType type)
     throws JsonMappingException {
   /* 27-Mar-2015, tatu: Wish I knew exactly why/what, but [databind#738]
    *    can be prevented by synchronizing on cache (not on 'this', however,
    *    since there's one instance per serialization).
    *   Perhaps not-yet-resolved instance might be exposed too early to callers.
    */
   synchronized (_serializerCache) {
     // 17-Feb-2013, tatu: Used to call deprecated method (that passed property)
     return (JsonSerializer<Object>) _serializerFactory.createSerializer(this, type);
   }
 }
 /**
  * Method called to get the {@link TypeSerializer} to use for including Type Id necessary for
  * serializing for the given Java class. Useful for schema generators.
  *
  * @since 2.6
  */
 public TypeSerializer findTypeSerializer(JavaType javaType) throws JsonMappingException {
   return _serializerFactory.createTypeSerializer(_config, javaType);
 }