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

com.talanlabs.componentjackson.ComponentValueInstantiators Maven / Gradle / Ivy

The newest version!
package com.talanlabs.componentjackson;

import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.module.SimpleValueInstantiators;
import com.talanlabs.component.IComponent;
import com.talanlabs.component.factory.ComponentFactory;

public class ComponentValueInstantiators extends SimpleValueInstantiators {

    @Override
    public ValueInstantiator findValueInstantiator(DeserializationConfig config, BeanDescription beanDesc, ValueInstantiator defaultInstantiator) {
        if (ComponentFactory.getInstance().isComponentType(beanDesc.getBeanClass())) {
            defaultInstantiator = new ComponentValueInstantiator((Class) beanDesc.getBeanClass(), defaultInstantiator);
        }
        return super.findValueInstantiator(config, beanDesc, defaultInstantiator);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy