com.fasterxml.jackson.databind.deser.std.ContainerDeserializerBase Maven / Gradle / Ivy
The newest version!
package com.fasterxml.jackson.databind.deser.std;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.deser.NullValueProvider;
import com.fasterxml.jackson.databind.deser.SettableBeanProperty;
import com.fasterxml.jackson.databind.deser.ValueInstantiator;
import com.fasterxml.jackson.databind.deser.impl.NullsConstantProvider;
import com.fasterxml.jackson.databind.type.TypeFactory;
import com.fasterxml.jackson.databind.util.AccessPattern;
import com.fasterxml.jackson.databind.util.ClassUtil;
/**
* Intermediate base deserializer class that adds more shared accessor
* so that other classes can access information about contained (value) types
*/
@SuppressWarnings("serial")
public abstract class ContainerDeserializerBase
extends StdDeserializer
implements ValueInstantiator.Gettable // since 2.9
{
protected final JavaType _containerType;
/**
* Handler we need for dealing with nulls.
*
* @since 2.9
*/
protected final NullValueProvider _nullProvider;
/**
* Marker flag set if the _nullProvider
indicates that all null
* content values should be skipped (instead of being possibly converted).
*
* @since 2.9
*/
protected final boolean _skipNullValues;
/**
* Specific override for this instance (from proper, or global per-type overrides)
* to indicate whether single value may be taken to mean an unwrapped one-element array
* or not. If null, left to global defaults.
*
* @since 2.9 (demoted from sub-classes where added in 2.7)
*/
protected final Boolean _unwrapSingle;
protected ContainerDeserializerBase(JavaType selfType,
NullValueProvider nuller, Boolean unwrapSingle) {
super(selfType);
_containerType = selfType;
_unwrapSingle = unwrapSingle;
_nullProvider = nuller;
_skipNullValues = NullsConstantProvider.isSkipper(nuller);
}
protected ContainerDeserializerBase(JavaType selfType) {
this(selfType, null, null);
}
/**
* @since 2.9
*/
protected ContainerDeserializerBase(ContainerDeserializerBase> base) {
this(base, base._nullProvider, base._unwrapSingle);
}
/**
* @since 2.9
*/
protected ContainerDeserializerBase(ContainerDeserializerBase> base,
NullValueProvider nuller, Boolean unwrapSingle) {
super(base._containerType);
_containerType = base._containerType;
_nullProvider = nuller;
_unwrapSingle = unwrapSingle;
_skipNullValues = NullsConstantProvider.isSkipper(nuller);
}
/*
/**********************************************************
/* Overrides
/**********************************************************
*/
@Override // since 2.9
public JavaType getValueType() { return _containerType; }
@Override // since 2.9
public Boolean supportsUpdate(DeserializationConfig config) {
return Boolean.TRUE;
}
@Override
public SettableBeanProperty findBackReference(String refName) {
JsonDeserializer