Package org.codehaus.jackson.mrbean
Class AbstractTypeMaterializer
- java.lang.Object
-
- org.codehaus.jackson.map.AbstractTypeResolver
-
- org.codehaus.jackson.mrbean.AbstractTypeMaterializer
-
- All Implemented Interfaces:
Versioned
public class AbstractTypeMaterializer extends AbstractTypeResolver implements Versioned
Nifty class for pulling implementations of classes out of thin air.... friends call him Mister Bean... :-)
- Since:
- 1.6
- Author:
- tatu, sunny
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractTypeMaterializer.Feature
Enumeration that defines togglable features that guide the serialization feature.
-
Field Summary
Fields Modifier and Type Field Description protected org.codehaus.jackson.mrbean.AbstractTypeMaterializer.MyClassLoader
_classLoader
We will use per-materializer class loader for now; would be nice to find a way to reduce number of class loaders (and hence number of generated classes!) constructed...protected java.lang.String
_defaultPackage
Package name to use as prefix for generated classes.protected int
_featureFlags
Bit set that contains all enabled featuresprotected static int
DEFAULT_FEATURE_FLAGS
Bitfield (set of flags) of all Features that are enabled by default.static java.lang.String
DEFAULT_PACKAGE_FOR_GENERATED
Default package to use for generated classes.
-
Constructor Summary
Constructors Constructor Description AbstractTypeMaterializer()
AbstractTypeMaterializer(java.lang.ClassLoader parentClassLoader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disable(AbstractTypeMaterializer.Feature f)
Method for disabling specified feature.void
enable(AbstractTypeMaterializer.Feature f)
Method for enabling specified feature.boolean
isEnabled(AbstractTypeMaterializer.Feature f)
Method for checking whether given feature is enabled or notprotected java.lang.Class<?>
materializeClass(DeserializationConfig config, java.lang.Class<?> cls)
JavaType
resolveAbstractType(DeserializationConfig config, JavaType type)
Method called to try to resolve an abstract type into concrete type (usually for purposes of deserializing), when no concrete implementation was found.void
set(AbstractTypeMaterializer.Feature f, boolean state)
Method for enabling or disabling specified feature.void
setDefaultPackage(java.lang.String defPkg)
Version
version()
Method that will return version information stored in and read from jar that contains this class.-
Methods inherited from class org.codehaus.jackson.map.AbstractTypeResolver
findTypeMapping
-
-
-
-
Field Detail
-
DEFAULT_FEATURE_FLAGS
protected static final int DEFAULT_FEATURE_FLAGS
Bitfield (set of flags) of all Features that are enabled by default.
-
DEFAULT_PACKAGE_FOR_GENERATED
public static final java.lang.String DEFAULT_PACKAGE_FOR_GENERATED
Default package to use for generated classes.- See Also:
- Constant Field Values
-
_classLoader
protected final org.codehaus.jackson.mrbean.AbstractTypeMaterializer.MyClassLoader _classLoader
We will use per-materializer class loader for now; would be nice to find a way to reduce number of class loaders (and hence number of generated classes!) constructed...
-
_featureFlags
protected int _featureFlags
Bit set that contains all enabled features
-
_defaultPackage
protected java.lang.String _defaultPackage
Package name to use as prefix for generated classes.
-
-
Method Detail
-
version
public Version version()
Method that will return version information stored in and read from jar that contains this class.
-
isEnabled
public final boolean isEnabled(AbstractTypeMaterializer.Feature f)
Method for checking whether given feature is enabled or not
-
enable
public void enable(AbstractTypeMaterializer.Feature f)
Method for enabling specified feature.
-
disable
public void disable(AbstractTypeMaterializer.Feature f)
Method for disabling specified feature.
-
set
public void set(AbstractTypeMaterializer.Feature f, boolean state)
Method for enabling or disabling specified feature.
-
setDefaultPackage
public void setDefaultPackage(java.lang.String defPkg)
-
resolveAbstractType
public JavaType resolveAbstractType(DeserializationConfig config, JavaType type)
Description copied from class:AbstractTypeResolver
Method called to try to resolve an abstract type into concrete type (usually for purposes of deserializing), when no concrete implementation was found. It will be called after checking all other possibilities, including defaulting.- Overrides:
resolveAbstractType
in classAbstractTypeResolver
- Parameters:
config
- Configuration in use; should always be of typeDeserializationConfig
type
- Type for which materialization maybe needed- Returns:
- Resolved concrete type (which should retain generic type parameters of input type, if any), if resolution succeeds; null if resolver does not know how to resolve type
-
materializeClass
protected java.lang.Class<?> materializeClass(DeserializationConfig config, java.lang.Class<?> cls)
-
-