1 package com.fasterxml.jackson.databind.annotation; 2 3 import java.lang.annotation.ElementType; 4 import java.lang.annotation.Retention; 5 import java.lang.annotation.RetentionPolicy; 6 import java.lang.annotation.Target; 7 8 9 import com.fasterxml.jackson.annotation.JacksonAnnotation; 10 import com.fasterxml.jackson.databind.jsontype.TypeIdResolver; 11 12 /** 13 * Annotation that can be used to plug a custom type identifier handler 14 * ({@link TypeIdResolver}) 15 * to be used by 16 * {@link com.fasterxml.jackson.databind.jsontype.TypeSerializer}s 17 * and {@link com.fasterxml.jackson.databind.jsontype.TypeDeserializer}s 18 * for converting between java types and type id included in JSON content. 19 * In simplest cases this can be a simple class with static mapping between 20 * type names and matching classes. 21 *<p> 22 * NOTE: since 2.4, applicable to properties as well (should have been long time 23 * ago, but problem only found then) 24 */ 25 @Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE, ElementType.PARAMETER}) 26 @Retention(RetentionPolicy.RUNTIME) 27 @JacksonAnnotation 28 public @interface JsonTypeIdResolver 29 { 30 /** 31 * Defines implementation class of {@link TypeIdResolver} to use for 32 * converting between external type id (type name) and actual 33 * type of object. 34 */ value()35 public Class<? extends TypeIdResolver> value(); 36 } 37