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

The following examples show how to use com.fasterxml.jackson.databind.deser.BeanDeserializer. 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: FlatteningDeserializer.java    From botbuilder-java with MIT License 6 votes vote down vote up
/**
 * Gets a module wrapping this serializer as an adapter for the Jackson
 * ObjectMapper.
 *
 * @param mapper the object mapper for default deserializations
 * @return a simple module to be plugged onto Jackson ObjectMapper.
 */
public static SimpleModule getModule(final ObjectMapper mapper) {
    SimpleModule module = new SimpleModule();
    module.setDeserializerModifier(new BeanDeserializerModifier() {
        @Override
        public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
            if (BeanDeserializer.class.isAssignableFrom(deserializer.getClass())) {
                // Apply flattening deserializer on all POJO types.
                return new FlatteningDeserializer(beanDesc.getBeanClass(), deserializer, mapper);
            } else {
                return deserializer;
            }
        }
    });
    return module;
}
 
Example #2
Source File: FlatteningDeserializer.java    From autorest-clientruntime-for-java with MIT License 6 votes vote down vote up
/**
 * Gets a module wrapping this serializer as an adapter for the Jackson
 * ObjectMapper.
 *
 * @param mapper the object mapper for default deserializations
 * @return a simple module to be plugged onto Jackson ObjectMapper.
 */
public static SimpleModule getModule(final ObjectMapper mapper) {
    SimpleModule module = new SimpleModule();
    module.setDeserializerModifier(new BeanDeserializerModifier() {
        @Override
        public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config, BeanDescription beanDesc, JsonDeserializer<?> deserializer) {
            if (BeanDeserializer.class.isAssignableFrom(deserializer.getClass())) {
                // Apply flattening deserializer on all POJO types.
                return new FlatteningDeserializer(beanDesc.getBeanClass(), deserializer, mapper);
            } else {
                return deserializer;
            }
        }
    });
    return module;
}
 
Example #3
Source File: EntityDeserializer.java    From onedev with MIT License 5 votes vote down vote up
public EntityDeserializer(
		Class<? extends AbstractEntity> entityClass, 
		BeanDeserializer defaultDeserializer, 
		Dao generalDao) {
	super(defaultDeserializer);
	
	this.entityClass = entityClass;
	this.defaultDeserializer = defaultDeserializer;
	this.generalDao = generalDao;
}
 
Example #4
Source File: TestDeserializerCaching.java    From jackson-modules-base with Apache License 2.0 5 votes vote down vote up
@Override
public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
        BeanDescription beanDesc, JsonDeserializer<?> deserializer)
{
    if (MyType.class.isAssignableFrom(beanDesc.getBeanClass())) {
        count++;
        return new MyBeanDeserializer((BeanDeserializer)deserializer);
    }
    return super.modifyDeserializer(config, beanDesc, deserializer);
}
 
Example #5
Source File: DeserializerModifier.java    From requery with Apache License 2.0 5 votes vote down vote up
@Override
public JsonDeserializer<?> modifyDeserializer(DeserializationConfig config,
                                              BeanDescription beanDesc,
                                              JsonDeserializer<?> deserializer) {
    if (deserializer instanceof BeanDeserializer) {
        BeanDeserializer beanDeserializer = (BeanDeserializer) deserializer;
        return new EntityBeanDeserializer(beanDeserializer, deserializer.getObjectIdReader());
    }
    return super.modifyDeserializer(config, beanDesc, deserializer);
}
 
Example #6
Source File: ThrowableDeserializer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public ThrowableDeserializer(BeanDeserializer baseDeserializer) {
    super(baseDeserializer);
    // need to disable this, since we do post-processing
    _vanillaProcessing = false;
}
 
Example #7
Source File: ThrowableDeserializer.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Alternative constructor used when creating "unwrapping" deserializers
 */
protected ThrowableDeserializer(BeanDeserializer src, NameTransformer unwrapper) {
    super(src, unwrapper);
}
 
Example #8
Source File: TestDeserializerCaching.java    From jackson-modules-base with Apache License 2.0 4 votes vote down vote up
public MyBeanDeserializer(BeanDeserializer src) {
    super(src);
}