com.fasterxml.jackson.module.mrbean

## Class AbstractTypeMaterializer

- java.lang.Object
- - com.fasterxml.jackson.databind.AbstractTypeResolver
  - - com.fasterxml.jackson.module.mrbean.AbstractTypeMaterializer

- All Implemented Interfaces:
    com.fasterxml.jackson.core.Versioned

      public class AbstractTypeMaterializer
      extends com.fasterxml.jackson.databind.AbstractTypeResolver
      implements com.fasterxml.jackson.core.Versioned

  Nifty class for pulling implementations of classes out of thin air.

  ... friends call him Mister Bean... :-)

  Author:
    tatu, sunny

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `AbstractTypeMaterializer.Feature` Enumeration that defines togglable features that guide the serialization feature.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected com.fasterxml.jackson.module.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 String` | `_defaultPackage` Package name to use as prefix for generated classes.
    `protected int` | `_featureFlags` Bit set that contains all enabled features
    `protected static int` | `DEFAULT_FEATURE_FLAGS` Bitfield (set of flags) of all Features that are enabled by default.
    `static String` | `DEFAULT_PACKAGE_FOR_GENERATED` Default package to use for generated classes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTypeMaterializer()`
    `AbstractTypeMaterializer(ClassLoader parentClassLoader)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Class<?>` | `_loadAndResolve(String className, byte[] bytecode, Class<?> rawType)`
    `protected Class<?>` | `_materializeRawType(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.introspect.AnnotatedClass typeDef, String nameToUse)`
    `protected boolean` | `_suitableType(com.fasterxml.jackson.databind.JavaType type)`
    `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 not
    `Class<?>` | `materializeGenericType(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.JavaType type)`
    `Class<?>` | `materializeRawType(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.introspect.AnnotatedClass typeDef)` NOTE: should not be called for generic types.
    `com.fasterxml.jackson.databind.JavaType` | `resolveAbstractType(com.fasterxml.jackson.databind.DeserializationConfig config, com.fasterxml.jackson.databind.BeanDescription beanDesc)` Entry-point for `AbstractTypeResolver` that Jackson calls to materialize an abstract type.
    `com.fasterxml.jackson.databind.JavaType` | `resolveAbstractType(com.fasterxml.jackson.databind.DeserializationConfig config, com.fasterxml.jackson.databind.JavaType type)` Deprecated.
    `void` | `set(AbstractTypeMaterializer.Feature f, boolean state)` Method for enabling or disabling specified feature.
    `void` | `setDefaultPackage(String defPkg)` Method for specifying package to use for generated classes.
    `com.fasterxml.jackson.core.Version` | `version()` Method that will return version information stored in and read from jar that contains this class.

    - ### Methods inherited from class com.fasterxml.jackson.databind.AbstractTypeResolver

      `findTypeMapping`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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 String DEFAULT_PACKAGE_FOR_GENERATED

      Default package to use for generated classes.
      See Also:
        Constant Field Values

    - #### _classLoader

          protected final com.fasterxml.jackson.module.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 String _defaultPackage

      Package name to use as prefix for generated classes.

  - ### Constructor Detail

    - #### AbstractTypeMaterializer

          public AbstractTypeMaterializer()

    - #### AbstractTypeMaterializer

          public AbstractTypeMaterializer(ClassLoader parentClassLoader)

      Parameters:
        `parentClassLoader` - Class loader to use for generated classes; if null, will use class loader that loaded materializer itself.

  - ### Method Detail

    - #### version

          public com.fasterxml.jackson.core.Version version()

      Method that will return version information stored in and read from jar that contains this class.
      Specified by:
        `version` in interface `com.fasterxml.jackson.core.Versioned`

    - #### 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(String defPkg)

      Method for specifying package to use for generated classes.

    - #### resolveAbstractType

          public com.fasterxml.jackson.databind.JavaType resolveAbstractType(com.fasterxml.jackson.databind.DeserializationConfig config,
                                                                             com.fasterxml.jackson.databind.BeanDescription beanDesc)

      Entry-point for `AbstractTypeResolver` that Jackson calls to materialize an abstract type.
      Overrides:
        `resolveAbstractType` in class `com.fasterxml.jackson.databind.AbstractTypeResolver`

    - #### resolveAbstractType

          @Deprecated
          public com.fasterxml.jackson.databind.JavaType resolveAbstractType(com.fasterxml.jackson.databind.DeserializationConfig config,
                                                                                         com.fasterxml.jackson.databind.JavaType type)

      Deprecated.
      Older variant of `resolveAbstractType(DeserializationConfig, BeanDescription)`, obsoleted in 2.7. Kept around in 2.7 for backwards compatibility.

      TODO: remove from 2.9

      Overrides:
        `resolveAbstractType` in class `com.fasterxml.jackson.databind.AbstractTypeResolver`

    - #### materializeGenericType

          public Class<?> materializeGenericType(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
                                                 com.fasterxml.jackson.databind.JavaType type)

      Since:
        2.4

    - #### materializeRawType

          public Class<?> materializeRawType(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
                                             com.fasterxml.jackson.databind.introspect.AnnotatedClass typeDef)

      NOTE: should not be called for generic types.
      Since:
        2.4

    - #### _materializeRawType

          protected Class<?> _materializeRawType(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
                                                 com.fasterxml.jackson.databind.introspect.AnnotatedClass typeDef,
                                                 String nameToUse)

    - #### _loadAndResolve

          protected Class<?> _loadAndResolve(String className,
                                             byte[] bytecode,
                                             Class<?> rawType)

    - #### _suitableType

          protected boolean _suitableType(com.fasterxml.jackson.databind.JavaType type)

Copyright © 2020 FasterXML. All rights reserved.