Java Code Examples for com.fasterxml.jackson.databind.deser.SettableBeanProperty#deserialize()

The following examples show how to use com.fasterxml.jackson.databind.deser.SettableBeanProperty#deserialize() . 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: FactoryBasedEnumDeserializer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
protected final Object _deserializeWithErrorWrapping(JsonParser p, DeserializationContext ctxt,
        SettableBeanProperty prop) throws IOException
{
    try {
        return prop.deserialize(p, ctxt);
    } catch (Exception e) {
        return wrapAndThrow(e, handledType(), prop.getName(), ctxt);
    }
}
 
Example 2
Source File: EntityBeanDeserializer.java    From requery with Apache License 2.0 4 votes vote down vote up
@Override
public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) throws IOException {
    if (_nonStandardCreation || _needViewProcesing) {
        return super.deserializeFromObject(p, ctxt);
    }

    Object bean = null;

    if (p.hasTokenId(JsonTokenId.ID_FIELD_NAME)) {
        String propertyName = p.getCurrentName();
        do {
            p.nextToken();
            SettableBeanProperty property = _beanProperties.find(propertyName);

            if (property == null) {
                handleUnknownVanilla(p, ctxt, bean, propertyName);
                continue;
            }

            // lazily create the bean, the id property must be the first property
            if (bean == null) {
                if (propertyName.equals(_objectIdReader.propertyName.getSimpleName())) {

                    // deserialize id
                    Object id = property.deserialize(p, ctxt);

                    ReadableObjectId objectId = ctxt.findObjectId(id,
                            _objectIdReader.generator, _objectIdReader.resolver);

                    bean = objectId == null ? null : objectId.resolve();
                    if (bean == null) {
                        bean = _valueInstantiator.createUsingDefault(ctxt);
                        property.set(bean, id);
                    }
                } else {
                    bean = _valueInstantiator.createUsingDefault(ctxt);
                }
                p.setCurrentValue(bean);
            }
            property.deserializeAndSet(p, ctxt, bean);

        } while ((propertyName = p.nextFieldName()) != null);
    }

    return bean;
}