Example usage for com.fasterxml.jackson.databind.deser BeanDeserializerBuilder addOrReplaceProperty

List of usage examples for com.fasterxml.jackson.databind.deser BeanDeserializerBuilder addOrReplaceProperty

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.deser BeanDeserializerBuilder addOrReplaceProperty.

Prototype

public void addOrReplaceProperty(SettableBeanProperty paramSettableBeanProperty, boolean paramBoolean) 

Source Link

Usage

From source file:de.javagl.jgltf.model.io.JacksonUtils.java

/**
 * Creates a BeanDeserializerModifier that replaces the 
 * SettableBeanProperties in the BeanDeserializerBuilder with
 * ErrorReportingSettableBeanProperty instances that forward
 * information about errors when setting bean properties to the
 * given consumer. (Don't ask ... )  /* ww  w  .j  ava 2  s  . c  om*/
 * 
 * @param jsonErrorConsumer The consumer for {@link JsonError}s.
 * If this is <code>null</code>, then no errors will be reported.
 * @return The modifier
 */
private static BeanDeserializerModifier createErrorHandlingBeanDeserializerModifier(
        Consumer<? super JsonError> jsonErrorConsumer) {
    return new BeanDeserializerModifier() {
        @Override
        public BeanDeserializerBuilder updateBuilder(DeserializationConfig config, BeanDescription beanDesc,
                BeanDeserializerBuilder builder) {
            Iterator<SettableBeanProperty> propertiesIterator = builder.getProperties();
            while (propertiesIterator.hasNext()) {
                SettableBeanProperty property = propertiesIterator.next();
                SettableBeanProperty wrappedProperty = new ErrorReportingSettableBeanProperty(property,
                        jsonErrorConsumer);
                builder.addOrReplaceProperty(wrappedProperty, true);
            }
            return builder;
        }
    };
}