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

The following examples show how to use com.fasterxml.jackson.databind.deser.BeanDeserializerBase. 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: DataBinderBeanDeserializerModifier.java    From gvnix with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
        BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
    if (deserializer instanceof BeanDeserializerBase) {
        return new DataBinderDeserializer(
                (BeanDeserializerBase) deserializer);
    }
    // When there is no custom-deserializer implementation returns the
    // default jackson deserializer
    return deserializer;
}
 
Example #2
Source File: StdDeserializer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
protected final NullValueProvider _findNullProvider(DeserializationContext ctxt,
        BeanProperty prop, Nulls nulls, JsonDeserializer<?> valueDeser)
    throws JsonMappingException
{
    if (nulls == Nulls.FAIL) {
        if (prop == null) {
            return NullsFailProvider.constructForRootValue(ctxt.constructType(valueDeser.handledType()));
        }
        return NullsFailProvider.constructForProperty(prop);
    }
    if (nulls == Nulls.AS_EMPTY) {
        // cannot deal with empty values if there is no value deserializer that
        // can indicate what "empty value" is:
        if (valueDeser == null) {
            return null;
        }

        // Let's first do some sanity checking...
        // NOTE: although we could use `ValueInstantiator.Gettable` in general,
        // let's not since that would prevent being able to use custom impls:
        if (valueDeser instanceof BeanDeserializerBase) {
            ValueInstantiator vi = ((BeanDeserializerBase) valueDeser).getValueInstantiator();
            if (!vi.canCreateUsingDefault()) {
                final JavaType type = prop.getType();
                ctxt.reportBadDefinition(type,
                        String.format("Cannot create empty instance of %s, no default Creator", type));
            }
        }
        // Second: can with pre-fetch value?
        {
            AccessPattern access = valueDeser.getEmptyAccessPattern();
            if (access == AccessPattern.ALWAYS_NULL) {
                return NullsConstantProvider.nuller();
            }
            if (access == AccessPattern.CONSTANT) {
                return NullsConstantProvider.forValue(valueDeser.getEmptyValue(ctxt));
            }
        }
        return new NullsAsEmptyProvider(valueDeser);
    }
    if (nulls == Nulls.SKIP) {
        return NullsConstantProvider.skipper();
    }
    return null;
}
 
Example #3
Source File: EntityBeanDeserializer.java    From requery with Apache License 2.0 4 votes vote down vote up
EntityBeanDeserializer(BeanDeserializerBase source, ObjectIdReader reader) {
    super(source, reader);
}
 
Example #4
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 4 votes vote down vote up
public DataBinderDeserializer(BeanDeserializerBase source) {
    super(source);
}
 
Example #5
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 4 votes vote down vote up
public DataBinderDeserializer(BeanDeserializerBase source,
        ObjectIdReader objectIdReader) {
    super(source, objectIdReader);
}
 
Example #6
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 4 votes vote down vote up
public DataBinderDeserializer(BeanDeserializerBase source,
        HashSet<String> ignorableProps) {
    super(source, ignorableProps);
}
 
Example #7
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * Uses {@link DataBinderDeserializer}
 */
@Override
public BeanDeserializerBase withIgnorableProperties(
        HashSet<String> ignorableProps) {
    return new DataBinderDeserializer(this, ignorableProps);
}
 
Example #8
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * Not used
 */
@Override
protected BeanDeserializerBase asArrayDeserializer() {
    // Not used
    return null;
}
 
Example #9
Source File: DataBinderDeserializer.java    From gvnix with GNU General Public License v3.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 * 
 * Uses {@link DataBinderDeserializer}
 */
@Override
public BeanDeserializerBase withObjectIdReader(ObjectIdReader objectIdReader) {
    return new DataBinderDeserializer(this, objectIdReader);
}