com.fasterxml.jackson.databind.util.ConstantValueInstantiator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ehcache Show documentation
Show all versions of ehcache Show documentation
Ehcache is an open source, standards-based cache used to boost performance,
offload the database and simplify scalability. Ehcache is robust, proven and full-featured and
this has made it the most widely-used Java-based cache.
package com.fasterxml.jackson.databind.util;
import java.io.IOException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
/**
* Trivial {@link ValueInstantiator} implementation that will simply return constant
* {@code Object} it is configured with. May be used as-is, or as base class to override
* simplistic behavior further.
*
* @since 2.9.4
*/
public class ConstantValueInstantiator extends ValueInstantiator
{
protected final Object _value;
public ConstantValueInstantiator(Object value) {
_value = value;
}
@Override
public Class> getValueClass() {
return _value.getClass();
}
@Override // yes, since default ctor works
public boolean canInstantiate() { return true; }
@Override
public boolean canCreateUsingDefault() { return true; }
@Override
public Object createUsingDefault(DeserializationContext ctxt) throws IOException {
return _value;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy