1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
package com.fasterxml.jackson.databind.cfg;
import java.util.Map;
import com.fasterxml.jackson.databind.jsontype.SubtypeResolver;
import com.fasterxml.jackson.databind.type.ClassKey;
public abstract class MapperConfigBase<CFG extends ConfigFeature,
T extends MapperConfigBase<CFG,T>>
extends MapperConfig<T>
{
private final static int DEFAULT_MAPPER_FEATURES = collectFeatureDefaults(MapperConfig.Feature.class);
/*
/**********************************************************
/* Immutable config
/**********************************************************
*/
/**
* Mix-in annotation mappings to use, if any: immutable,
* can not be changed once defined.
*/
protected final Map<ClassKey,Class<?>> _mixInAnnotations;
/**
* Registered concrete subtypes that can be used instead of (or
* in addition to) ones declared using annotations.
*/
protected final SubtypeResolver _subtypeResolver;
/*
/**********************************************************
/* Construction
/**********************************************************
*/
/**
* Constructor used when creating a new instance (compared to
* that of creating fluent copies)
*/
protected MapperConfigBase(BaseSettings base,
SubtypeResolver str, Map<ClassKey,Class<?>> mixins)
{
super(base, DEFAULT_MAPPER_FEATURES);
_mixInAnnotations = mixins;
_subtypeResolver = str;
}
/**
* Pass-through constructor used when no changes are needed to the
* base class.
*/
protected MapperConfigBase(MapperConfigBase<CFG,T> src) {
super(src);
_mixInAnnotations = src._mixInAnnotations;
_subtypeResolver = src._subtypeResolver;
}
protected MapperConfigBase(MapperConfigBase<CFG,T> src, int mapperFeatures)
{
super(src._base, mapperFeatures);
_mixInAnnotations = src._mixInAnnotations;
_subtypeResolver = src._subtypeResolver;
}
protected MapperConfigBase(MapperConfigBase<CFG,T> src, SubtypeResolver str) {
super(src);
_mixInAnnotations = src._mixInAnnotations;
_subtypeResolver = str;
}
protected MapperConfigBase(MapperConfigBase<CFG,T> src, BaseSettings base)
{
super(base, src._mapperFeatures);
_mixInAnnotations = src._mixInAnnotations;
_subtypeResolver = src._subtypeResolver;
}
/*
/**********************************************************
/* Simple accessors
/**********************************************************
*/
public abstract int getFeatureFlags();
/**
* Accessor for object used for finding out all reachable subtypes
* for supertypes; needed when a logical type name is used instead
* of class name (or custom scheme).
*/
public final SubtypeResolver getSubtypeResolver() {
return _subtypeResolver;
}
/*
/**********************************************************
/* ClassIntrospector.MixInResolver impl:
/**********************************************************
*/
/**
* Method that will check if there are "mix-in" classes (with mix-in
* annotations) for given class
*/
@Override
public final Class<?> findMixInClassFor(Class<?> cls) {
return (_mixInAnnotations == null) ? null : _mixInAnnotations.get(new ClassKey(cls));
}
public final int mixInCount() {
return (_mixInAnnotations == null) ? 0 : _mixInAnnotations.size();
}
}
|