1 package com.fasterxml.jackson.databind.jsonFormatVisitors; 2 3 import com.fasterxml.jackson.databind.JavaType; 4 import com.fasterxml.jackson.databind.JsonMappingException; 5 import com.fasterxml.jackson.databind.SerializerProvider; 6 7 public interface JsonMapFormatVisitor extends JsonFormatVisitorWithSerializerProvider 8 { 9 /** 10 * Visit method called to indicate type of keys of the Map type 11 * being visited 12 */ keyFormat(JsonFormatVisitable handler, JavaType keyType)13 public void keyFormat(JsonFormatVisitable handler, JavaType keyType) throws JsonMappingException; 14 15 /** 16 * Visit method called after {@link #keyFormat} to allow visiting of 17 * the value type 18 */ valueFormat(JsonFormatVisitable handler, JavaType valueType)19 public void valueFormat(JsonFormatVisitable handler, JavaType valueType) throws JsonMappingException; 20 21 /** 22 * Default "empty" implementation, useful as the base to start on; 23 * especially as it is guaranteed to implement all the method 24 * of the interface, even if new methods are getting added. 25 */ 26 public static class Base 27 implements JsonMapFormatVisitor 28 { 29 protected SerializerProvider _provider; 30 Base()31 public Base() { } Base(SerializerProvider p)32 public Base(SerializerProvider p) { _provider = p; } 33 34 @Override getProvider()35 public SerializerProvider getProvider() { return _provider; } 36 37 @Override setProvider(SerializerProvider p)38 public void setProvider(SerializerProvider p) { _provider = p; } 39 40 @Override keyFormat(JsonFormatVisitable handler, JavaType keyType)41 public void keyFormat(JsonFormatVisitable handler, JavaType keyType) throws JsonMappingException { } 42 @Override valueFormat(JsonFormatVisitable handler, JavaType valueType)43 public void valueFormat(JsonFormatVisitable handler, JavaType valueType) throws JsonMappingException { } 44 } 45 } 46