1 package com.fasterxml.jackson.databind.type;
2
3 import java.lang.reflect.Type;
4
5 import com.fasterxml.jackson.databind.JavaType;
6
7 /**
8 * Class that defines API that can be used to modify details of
9 * {@link JavaType} instances constructed using {@link TypeFactory}.
10 * Registered modifiers are called in order, to let them modify (or
11 * replace) basic type instance factory constructs.
12 * This is typically needed to support creation of
13 * {@link MapLikeType} and {@link CollectionLikeType} instances,
14 * as those cannot be constructed in generic fashion.
15 */
16 public abstract class TypeModifier
17 {
18 /**
19 * Method called to let modifier change constructed type definition.
20 * Note that this is only guaranteed to be called for
21 * non-container types ("simple" types not recognized as arrays,
22 * <code>java.util.Collection</code> or <code>java.util.Map</code>).
23 *
24 * @param type Instance to modify
25 * @param jdkType JDK type that was used to construct instance to modify
26 * @param context Type resolution context used for the type
27 * @param typeFactory Type factory that can be used to construct parameter type; note,
28 * however, that care must be taken to avoid infinite loops -- specifically, do not
29 * construct instance of primary type itself
30 *
31 * @return Actual type instance to use; usually either <code>type</code> (as is or with
32 * modifications), or a newly constructed type instance based on it. Cannot be null.
33 */
34 public abstract JavaType modifyType(JavaType type, Type jdkType, TypeBindings context,
35 TypeFactory typeFactory);
36 }
37