All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fasterxml.jackson.module.mrbean.MrBeanModule Maven / Gradle / Ivy

Go to download

Functionality for implementing interfaces and abstract types dynamically ("bean materialization"), integrated with Jackson (although usable externally as well)

The newest version!
package com.fasterxml.jackson.module.mrbean;

import com.fasterxml.jackson.core.Version;

public class MrBeanModule extends com.fasterxml.jackson.databind.Module
{
    /**
     * Configured materializer instance to register with deserializer factory.
     */
    protected AbstractTypeMaterializer _materializer;
    
    /*
    /**********************************************************
    /* Life-cycle
    /**********************************************************
     */
    
    public MrBeanModule() {
        this(new AbstractTypeMaterializer());
    }

    public MrBeanModule(AbstractTypeMaterializer materializer) {
        _materializer = materializer;
    }

    @Override
    public String getModuleName() {
        return getClass().getSimpleName();
    }

    @Override
    public Version version() {
        return PackageVersion.VERSION;
    }
    
    @Override
    public void setupModule(SetupContext context)
    {
        // All we really need to for now is to register materializer:
        context.addAbstractTypeResolver(_materializer);
    }

    /*
    /**********************************************************
    /* Extended API
    /**********************************************************
     */

    /**
     * Accessor for getting internal {@link AbstractTypeMaterializer}.
     */
    public AbstractTypeMaterializer getMaterializer() {
        return _materializer;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy