com.fasterxml.jackson.databind.deser.NullValueProvider Java Examples

The following examples show how to use com.fasterxml.jackson.databind.deser.NullValueProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EnumMapDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.9
 */
protected EnumMapDeserializer(EnumMapDeserializer base,
        KeyDeserializer keyDeser, JsonDeserializer<?> valueDeser, TypeDeserializer vtd,
        NullValueProvider nuller)
{
    super(base, nuller, base._unwrapSingle);
    _enumClass = base._enumClass;
    _keyDeserializer = keyDeser;
    _valueDeserializer = (JsonDeserializer<Object>) valueDeser;
    _valueTypeDeserializer = vtd;

    _valueInstantiator = base._valueInstantiator;
    _delegateDeserializer = base._delegateDeserializer;
    _propertyBasedCreator = base._propertyBasedCreator;
}
 
Example #2
Source File: StringCollectionDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected StringCollectionDeserializer(JavaType collectionType,
        ValueInstantiator valueInstantiator, JsonDeserializer<?> delegateDeser,
        JsonDeserializer<?> valueDeser,
        NullValueProvider nuller, Boolean unwrapSingle)
{
    super(collectionType, nuller, unwrapSingle);
    _valueDeserializer = (JsonDeserializer<String>) valueDeser;
    _valueInstantiator = valueInstantiator;
    _delegateDeserializer = (JsonDeserializer<Object>) delegateDeser;
}
 
Example #3
Source File: ImmutableMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableMapDeserializer withResolved(KeyDeserializer keyDeser,
        JsonDeserializer<?> valueDeser, TypeDeserializer valueTypeDeser,
        NullValueProvider nuller) {
    return new ImmutableMapDeserializer(_containerType, keyDeser,
            valueDeser, valueTypeDeser, nuller);
}
 
Example #4
Source File: ObjectArrayDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected ObjectArrayDeserializer(ObjectArrayDeserializer base,
        JsonDeserializer<Object> elemDeser, TypeDeserializer elemTypeDeser,
        NullValueProvider nuller, Boolean unwrapSingle)
{
    super(base, nuller, unwrapSingle);
    _elementClass = base._elementClass;
    _untyped = base._untyped;

    _elementDeserializer = elemDeser;
    _elementTypeDeserializer = elemTypeDeser;
}
 
Example #5
Source File: StdDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method called to find {@link NullValueProvider} for a primary property, using
 * "value nulls" setting. If no provider found (not defined, or is "skip"),
 * will return `null`.
 *
 * @since 2.9
 */
protected final NullValueProvider findValueNullProvider(DeserializationContext ctxt,
        SettableBeanProperty prop, PropertyMetadata propMetadata)
    throws JsonMappingException
{
    if (prop != null) {
        return _findNullProvider(ctxt, prop, propMetadata.getValueNulls(),
                prop.getValueDeserializer());
    }
    return null;
}
 
Example #6
Source File: ImmutableSortedMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
public GuavaMapDeserializer<ImmutableSortedMap<Object, Object>> withResolved(KeyDeserializer keyDeser,
        JsonDeserializer<?> valueDeser, TypeDeserializer typeDeser,
        NullValueProvider nuller)
{
    return new ImmutableSortedMapDeserializer(_containerType, keyDeser, valueDeser, typeDeser, nuller);
}
 
Example #7
Source File: GuavaCollectionDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
protected GuavaCollectionDeserializer(JavaType selfType,
        JsonDeserializer<?> deser, TypeDeserializer typeDeser,
        NullValueProvider nuller, Boolean unwrapSingle)
{
    super(selfType, nuller, unwrapSingle);
    _valueTypeDeserializer = typeDeser;
    _valueDeserializer = deser;
}
 
Example #8
Source File: GuavaCollectionDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
/**
 * Method called to finalize setup of this deserializer,
 * after deserializer itself has been registered. This
 * is needed to handle recursive and transitive dependencies.
 */
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
        BeanProperty property) throws JsonMappingException
{
    Boolean unwrapSingle = findFormatFeature(ctxt, property, Collection.class,
            JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);

    JsonDeserializer<?> valueDeser = _valueDeserializer;
    TypeDeserializer valueTypeDeser = _valueTypeDeserializer;
    if (valueDeser == null) {
        valueDeser = ctxt.findContextualValueDeserializer(_containerType.getContentType(), property);
    }
    if (valueTypeDeser != null) {
        valueTypeDeser = valueTypeDeser.forProperty(property);
    }

    NullValueProvider nuller = findContentNullProvider(ctxt, property, valueDeser);

    if ( (unwrapSingle != _unwrapSingle)
            || (nuller != _nullProvider)
            || (valueDeser != _valueDeserializer)
            || (valueTypeDeser != _valueTypeDeserializer)) {
        return withResolved(valueDeser, valueTypeDeser, nuller, unwrapSingle);
    }
    return this;
}
 
Example #9
Source File: StdDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Method called to find {@link NullValueProvider} for a contents of a structured
 * primary property (Collection, Map, array), using
 * "content nulls" setting. If no provider found (not defined),
 * will return given value deserializer (which is a null value provider itself).
 *
 * @since 2.9
 */
protected NullValueProvider findContentNullProvider(DeserializationContext ctxt,
        BeanProperty prop, JsonDeserializer<?> valueDeser)
    throws JsonMappingException
{
    final Nulls nulls = findContentNullStyle(ctxt, prop);
    if (nulls == Nulls.SKIP) {
        return NullsConstantProvider.skipper();
    }
    NullValueProvider prov = _findNullProvider(ctxt, prop, nulls, valueDeser);
    if (prov != null) {
        return prov;
    }
    return valueDeser;
}
 
Example #10
Source File: PrimitiveArrayDeserializers.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.7
 */
protected PrimitiveArrayDeserializers(PrimitiveArrayDeserializers<?> base,
        NullValueProvider nuller, Boolean unwrapSingle) {
    super(base._valueClass);
    _unwrapSingle = unwrapSingle;
    _nuller = nuller;
}
 
Example #11
Source File: LinkedHashMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method, NullValueProvider nvp)
{
    return new LinkedHashMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #12
Source File: StringCollectionDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected StringCollectionDeserializer withResolved(JsonDeserializer<?> delegateDeser,
        JsonDeserializer<?> valueDeser,
        NullValueProvider nuller, Boolean unwrapSingle)
{
    if ((_unwrapSingle == unwrapSingle) && (_nullProvider == nuller)
            && (_valueDeserializer == valueDeser) && (_delegateDeserializer == delegateDeser)) {
        return this;
    }
    return new StringCollectionDeserializer(_containerType, _valueInstantiator,
            delegateDeser, valueDeser, nuller, unwrapSingle);
}
 
Example #13
Source File: GuavaMapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
protected GuavaMapDeserializer(JavaType type, KeyDeserializer keyDeser,
        JsonDeserializer<?> valueDeser, TypeDeserializer valueTypeDeser,
        NullValueProvider nuller)
{
    super(type, nuller, null);
    _keyDeserializer = keyDeser;
    _valueDeserializer = valueDeser;
    _valueTypeDeserializer = valueTypeDeser;
}
 
Example #14
Source File: ArrayListMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method,
        NullValueProvider nvp) {
    return new ArrayListMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #15
Source File: EnumMapDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.9
 */
public EnumMapDeserializer(JavaType mapType, ValueInstantiator valueInst,
        KeyDeserializer keyDeser, JsonDeserializer<?> valueDeser, TypeDeserializer vtd,
        NullValueProvider nuller)
{
    super(mapType, nuller, null);
    _enumClass = mapType.getKeyType().getRawClass();
    _keyDeserializer = keyDeser;
    _valueDeserializer = (JsonDeserializer<Object>) valueDeser;
    _valueTypeDeserializer = vtd;
    _valueInstantiator = valueInst;
}
 
Example #16
Source File: ObjectArrayDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @since 2.7
 */
@SuppressWarnings("unchecked")
public ObjectArrayDeserializer withResolved(TypeDeserializer elemTypeDeser,
        JsonDeserializer<?> elemDeser, NullValueProvider nuller, Boolean unwrapSingle)
{
    if ((unwrapSingle == _unwrapSingle) && (nuller == _nullProvider)
            && (elemDeser == _elementDeserializer)
            && (elemTypeDeser == _elementTypeDeserializer)) {
        return this;
    }
    return new ObjectArrayDeserializer(this,
            (JsonDeserializer<Object>) elemDeser, elemTypeDeser,
            nuller, unwrapSingle);
}
 
Example #17
Source File: EnumMapDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public EnumMapDeserializer withResolved(KeyDeserializer keyDeserializer,
        JsonDeserializer<?> valueDeserializer, TypeDeserializer valueTypeDeser,
        NullValueProvider nuller)
{
    if ((keyDeserializer == _keyDeserializer) && (nuller == _nullProvider)
            && (valueDeserializer == _valueDeserializer) && (valueTypeDeser == _valueTypeDeserializer)) {
        return this;
    }
    return new EnumMapDeserializer(this,
            keyDeserializer, valueDeserializer, valueTypeDeser, nuller);
}
 
Example #18
Source File: ContainerDeserializerBase.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @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);
}
 
Example #19
Source File: ArrayBlockingQueueDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructor used when creating contextualized instances.
 */
 protected ArrayBlockingQueueDeserializer(JavaType containerType,
        JsonDeserializer<Object> valueDeser, TypeDeserializer valueTypeDeser,
        ValueInstantiator valueInstantiator,
        JsonDeserializer<Object> delegateDeser,
        NullValueProvider nuller, Boolean unwrapSingle)
{
    super(containerType, valueDeser, valueTypeDeser, valueInstantiator, delegateDeser,
            nuller, unwrapSingle);
}
 
Example #20
Source File: ArrayBlockingQueueDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Fluent-factory method call to construct contextual instance.
 */
@Override
@SuppressWarnings("unchecked")
protected ArrayBlockingQueueDeserializer withResolved(JsonDeserializer<?> dd,
        JsonDeserializer<?> vd, TypeDeserializer vtd,
        NullValueProvider nuller, Boolean unwrapSingle)
{
    return new ArrayBlockingQueueDeserializer(_containerType,
            (JsonDeserializer<Object>) vd, vtd,
            _valueInstantiator, (JsonDeserializer<Object>) dd,
            nuller, unwrapSingle);
}
 
Example #21
Source File: StringArrayDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected StringArrayDeserializer(JsonDeserializer<?> deser,
        NullValueProvider nuller, Boolean unwrapSingle) {
    super(String[].class);
    _elementDeserializer = (JsonDeserializer<String>) deser;
    _nullProvider = nuller;
    _unwrapSingle = unwrapSingle;
    _skipNullValues = NullsConstantProvider.isSkipper(nuller);
}
 
Example #22
Source File: StringArrayDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Contextualization is needed to see whether we can "inline" deserialization
 * of String values, or if we have to use separate value deserializer.
 */
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property)
        throws JsonMappingException
{
    JsonDeserializer<?> deser = _elementDeserializer;
    // May have a content converter
    deser = findConvertingContentDeserializer(ctxt, property, deser);
    JavaType type = ctxt.constructType(String.class);
    if (deser == null) {
        deser = ctxt.findContextualValueDeserializer(type, property);
    } else { // if directly assigned, probably not yet contextual, so:
        deser = ctxt.handleSecondaryContextualization(deser, property, type);
    }
    // One more thing: allow unwrapping?
    Boolean unwrapSingle = findFormatFeature(ctxt, property, String[].class,
            JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
    NullValueProvider nuller = findContentNullProvider(ctxt, property, deser);
    // Ok ok: if all we got is the default String deserializer, can just forget about it
    if ((deser != null) && isDefaultDeserializer(deser)) {
        deser = null;
    }
    if ((_elementDeserializer == deser)
            && (_unwrapSingle == unwrapSingle)
            && (_nullProvider == nuller)) {
        return this;
    }
    return new StringArrayDeserializer(deser, nuller, unwrapSingle);
}
 
Example #23
Source File: ObjectIdReferenceProperty.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public ObjectIdReferenceProperty(ObjectIdReferenceProperty src, JsonDeserializer<?> deser,
        NullValueProvider nva)
{
    super(src, deser, nva);
    _forward = src._forward;
    _objectIdInfo = src._objectIdInfo;
}
 
Example #24
Source File: FieldProperty.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected FieldProperty(FieldProperty src, JsonDeserializer<?> deser,
        NullValueProvider nva) {
    super(src, deser, nva);
    _annotated = src._annotated;
    _field = src._field;
    _skipNulls = NullsConstantProvider.isSkipper(nva);
}
 
Example #25
Source File: LinkedListMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Override
protected JsonDeserializer<?> _createContextual(JavaType type,
        KeyDeserializer keyDeserializer, TypeDeserializer typeDeserializer,
        JsonDeserializer<?> elementDeserializer, Method method, NullValueProvider nvp) {
    return new LinkedListMultimapDeserializer(type, keyDeserializer, typeDeserializer,
            elementDeserializer, method, nvp);
}
 
Example #26
Source File: MethodProperty.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected MethodProperty(MethodProperty src, JsonDeserializer<?> deser,
        NullValueProvider nva) {
    super(src, deser, nva);
    _annotated = src._annotated;
    _setter = src._setter;
    _skipNulls = NullsConstantProvider.isSkipper(nva);
}
 
Example #27
Source File: GuavaMultimapDeserializer.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public GuavaMultimapDeserializer(JavaType type, KeyDeserializer keyDeserializer,
        TypeDeserializer elementTypeDeserializer, JsonDeserializer<?> elementDeserializer,
        Method creatorMethod, NullValueProvider nvp)
{
    super(type, nvp, null);
    this._keyDeserializer = keyDeserializer;
    this._valueTypeDeserializer = elementTypeDeserializer;
    this._valueDeserializer = (JsonDeserializer<Object>) elementDeserializer;
    this.creatorMethod = creatorMethod;
}
 
Example #28
Source File: CustomCollectionDeserializer.java    From caravan with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor used when creating contextualized instances.
 *
 * @since 2.9
 */
protected CustomCollectionDeserializer(JavaType collectionType,
    JsonDeserializer<Object> valueDeser, TypeDeserializer valueTypeDeser,
    ValueInstantiator valueInstantiator, JsonDeserializer<Object> delegateDeser,
    NullValueProvider nuller, Boolean unwrapSingle) {
  super(collectionType, nuller, unwrapSingle);
  _valueDeserializer = valueDeser;
  _valueTypeDeserializer = valueTypeDeser;
  _valueInstantiator = valueInstantiator;
  _delegateDeserializer = delegateDeser;
}
 
Example #29
Source File: CustomCollectionDeserializer.java    From caravan with Apache License 2.0 5 votes vote down vote up
/**
 * Fluent-factory method call to construct contextual instance.
 *
 * @since 2.9
 */
@SuppressWarnings("unchecked")
protected CustomCollectionDeserializer withResolved(JavaType vt, JsonDeserializer<?> dd,
    JsonDeserializer<?> vd, TypeDeserializer vtd,
    NullValueProvider nuller, Boolean unwrapSingle) {
  return new CustomCollectionDeserializer(_containerType,
      (JsonDeserializer<Object>) vd, vtd,
      _valueInstantiator, (JsonDeserializer<Object>) dd,
      nuller, unwrapSingle);
}
 
Example #30
Source File: MapDeserializerManager.java    From caravan with Apache License 2.0 5 votes vote down vote up
protected CustomCollectionDeserializer withResolved(JavaType pairType, JsonDeserializer<?> dd, JsonDeserializer<?> vd, TypeDeserializer vtd,
    NullValueProvider nuller,
    Boolean unwrapSingle) {

  MapDeserializer deserializer = deserializers.get(pairType);
  if (deserializer == null) {
    deserializer = factory.createDeserializer(pairType);
    deserializer = deserializer.withResolved(pairType, dd, vd, vtd, nuller, unwrapSingle);

    deserializers.put(pairType, deserializer);
  }

  return deserializer;
}