Class SimpleMixInResolver
java.lang.Object
com.fasterxml.jackson.databind.introspect.SimpleMixInResolver
- All Implemented Interfaces:
ClassIntrospector.MixInResolver
,Serializable
public class SimpleMixInResolver
extends Object
implements ClassIntrospector.MixInResolver, Serializable
Simple implementation of
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).
- Since:
- 2.6
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLocalDefinition
(Class<?> target, Class<?> mixinSource) copy()
Method called to create a new, non-shared copy, to be used by differentObjectMapper
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 classboolean
Method that may be called for optimization purposes, to see if calls to mix-in resolver may be avoided.int
void
setLocalDefinitions
(Map<Class<?>, Class<?>> sourceMixins) Mutant factory method that constructs a new instance that has no locally defined mix-in/target mappings.withOverrides
(ClassIntrospector.MixInResolver overrides) Mutant factory for constructor a new resolver instance with given mix-in resolver override.
-
Constructor Details
-
SimpleMixInResolver
-
-
Method Details
-
withOverrides
Mutant factory for constructor a new resolver instance with given mix-in resolver override. -
withoutLocalDefinitions
Mutant factory method that constructs a new instance that has no locally defined mix-in/target mappings. -
setLocalDefinitions
-
addLocalDefinition
-
copy
Description copied from interface:ClassIntrospector.MixInResolver
Method called to create a new, non-shared copy, to be used by differentObjectMapper
instance, and one that should not be connected to this instance, if resolver has mutable state. If resolver is immutable may simply return `this`.- Specified by:
copy
in interfaceClassIntrospector.MixInResolver
-
findMixInClassFor
Description copied from interface:ClassIntrospector.MixInResolver
Method that will check if there are "mix-in" classes (with mix-in annotations) for given class- Specified by:
findMixInClassFor
in interfaceClassIntrospector.MixInResolver
-
localSize
public int localSize() -
hasMixIns
public boolean hasMixIns()Method that may be called for optimization purposes, to see if calls to mix-in resolver may be avoided. Return value oftrue
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.
- Returns:
- True, if this resolver MAY have mix-ins to apply; false if not (it is "empty")
- Since:
- 2.10.1
-