1 package com.fasterxml.jackson.databind.deser; 2 3 import com.fasterxml.jackson.databind.*; 4 5 /** 6 * Add-on interface that {@link KeyDeserializer}s can implement to get a callback 7 * that can be used to create contextual instances of key deserializer to use for 8 * handling Map keys of supported type. This can be useful 9 * for key deserializers that can be configured by annotations, or should otherwise 10 * have differing behavior depending on what kind of Map property keys are being deserialized. 11 */ 12 public interface ContextualKeyDeserializer 13 { 14 /** 15 * Method called to see if a different (or differently configured) key deserializer 16 * is needed to deserialize keys of specified Map property. 17 * Note that instance that this method is called on is typically shared one and 18 * as a result method should <b>NOT</b> modify this instance but rather construct 19 * and return a new instance. This instance should only be returned as-is, in case 20 * it is already suitable for use. 21 * 22 * @param ctxt Deserialization context to access configuration, additional 23 * deserializers that may be needed by this deserializer 24 * @param property Method, field or constructor parameter that declared Map for which 25 * contextual instance will be used. Will not be available when deserializing root-level 26 * Map value; otherwise should not be null. 27 * 28 * @return Key deserializer to use for deserializing keys specified Map property, 29 * may be this instance or a new instance. 30 */ createContextual(DeserializationContext ctxt, BeanProperty property)31 public KeyDeserializer createContextual(DeserializationContext ctxt, 32 BeanProperty property) 33 throws JsonMappingException; 34 } 35