com.talanlabs.componentjackson.ComponentValueInstantiator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of component-jackson Show documentation
Show all versions of component-jackson Show documentation
Module Jackson for Component Bean
The newest version!
package com.talanlabs.componentjackson;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.talanlabs.component.IComponent;
import com.talanlabs.component.factory.ComponentFactory;
import java.io.IOException;
public class ComponentValueInstantiator extends ValueInstantiator {
private final Class extends IComponent> componentClass;
private final ValueInstantiator defaultInstantiator;
public ComponentValueInstantiator(Class extends IComponent> componentClass, ValueInstantiator defaultInstantiator) {
super();
this.componentClass = componentClass;
this.defaultInstantiator = defaultInstantiator;
}
@Override
public String getValueTypeDesc() {
return defaultInstantiator.getValueTypeDesc();
}
@Override
public boolean canCreateUsingDefault() {
return true;
}
@Override
public Object createUsingDefault(DeserializationContext ctxt) throws IOException {
return ComponentFactory.getInstance().createInstance(componentClass);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy