1 package com.fasterxml.jackson.databind.deser; 2 3 import com.fasterxml.jackson.databind.DeserializationContext; 4 import com.fasterxml.jackson.databind.JsonMappingException; 5 import com.fasterxml.jackson.databind.util.AccessPattern; 6 7 /** 8 * Helper interface implemented by classes that are to be used as 9 * null providers during deserialization. Most importantly implemented by 10 * {@link com.fasterxml.jackson.databind.JsonDeserializer} (as a mix-in 11 * interface), but also by converters used to support more configurable 12 * null replacement. 13 * 14 * @since 2.9 15 */ 16 public interface NullValueProvider 17 { 18 /** 19 * Method called to possibly convert incoming `null` token (read via 20 * underlying streaming input source) into other value of type accessor 21 * supports. May return `null`, or value compatible with type binding. 22 *<p> 23 * NOTE: if {@link #getNullAccessPattern()} returns `ALWAYS_NULL` or 24 * `CONSTANT`, this method WILL NOT use provided `ctxt` and it may thus 25 * be passed as `null`. 26 */ getNullValue(DeserializationContext ctxt)27 public Object getNullValue(DeserializationContext ctxt) throws JsonMappingException; 28 29 /** 30 * Accessor that may be used to determine if and when provider must be called to 31 * access null replacement value. 32 */ getNullAccessPattern()33 public AccessPattern getNullAccessPattern(); 34 } 35