public class SimpleMixInResolver extends Object implements ClassIntrospector.MixInResolver, Serializable
ClassIntrospector.MixInResolver
that just uses a Map
for containing mapping
from target to mix-in classes.
Implementation is only thread-safe after initialization (that is, when underlying Map is not modified but only read).
Modifier and Type | Field and Description |
---|---|
protected Map<ClassKey,Class<?>> |
_localMixIns
Simple mix-in targets defined locally.
|
protected ClassIntrospector.MixInResolver |
_overrides
External resolver that gets called before looking at any locally defined
mix-in target classes.
|
Modifier | Constructor and Description |
---|---|
|
SimpleMixInResolver(ClassIntrospector.MixInResolver overrides) |
protected |
SimpleMixInResolver(ClassIntrospector.MixInResolver overrides,
Map<ClassKey,Class<?>> mixins) |
Modifier and Type | Method and Description |
---|---|
void |
addLocalDefinition(Class<?> target,
Class<?> mixinSource) |
SimpleMixInResolver |
copy()
Method called to create a new, non-shared copy, to be used by different
ObjectMapper instance, and one that should not be connected
to this instance, if resolver has mutable state. |
Class<?> |
findMixInClassFor(Class<?> cls)
Method that will check if there are "mix-in" classes (with mix-in
annotations) for given class
|
boolean |
hasMixIns()
Method that may be called for optimization purposes, to see if calls to
mix-in resolver may be avoided.
|
int |
localSize() |
void |
setLocalDefinitions(Map<Class<?>,Class<?>> sourceMixins) |
SimpleMixInResolver |
withoutLocalDefinitions()
Mutant factory method that constructs a new instance that has no locally
defined mix-in/target mappings.
|
SimpleMixInResolver |
withOverrides(ClassIntrospector.MixInResolver overrides)
Mutant factory for constructor a new resolver instance with given
mix-in resolver override.
|
protected final ClassIntrospector.MixInResolver _overrides
public SimpleMixInResolver(ClassIntrospector.MixInResolver overrides)
protected SimpleMixInResolver(ClassIntrospector.MixInResolver overrides, Map<ClassKey,Class<?>> mixins)
public SimpleMixInResolver withOverrides(ClassIntrospector.MixInResolver overrides)
public SimpleMixInResolver withoutLocalDefinitions()
public SimpleMixInResolver copy()
ClassIntrospector.MixInResolver
ObjectMapper
instance, and one that should not be connected
to this instance, if resolver has mutable state.
If resolver is immutable may simply return `this`.copy
in interface ClassIntrospector.MixInResolver
public Class<?> findMixInClassFor(Class<?> cls)
ClassIntrospector.MixInResolver
findMixInClassFor
in interface ClassIntrospector.MixInResolver
public int localSize()
public boolean hasMixIns()
true
means that
it is possible that a mix-in class will be found; false
that no
mix-in will ever be found. In latter case caller can avoid calls altogether.
Note that the reason for "empty" resolvers is to use "null object" for simplifying code.
Copyright © 2008–2019 FasterXML. All rights reserved.