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

The following examples show how to use com.fasterxml.jackson.databind.deser.SettableBeanProperty#withValueDeserializer() . 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: BeanPropertyMap.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
protected SettableBeanProperty _rename(SettableBeanProperty prop, NameTransformer xf)
{
    if (prop == null) {
        return prop;
    }
    String newName = xf.transform(prop.getName());
    prop = prop.withSimpleName(newName);
    JsonDeserializer<?> deser = prop.getValueDeserializer();
    if (deser != null) {
        @SuppressWarnings("unchecked")
        JsonDeserializer<Object> newDeser = (JsonDeserializer<Object>)
            deser.unwrappingDeserializer(xf);
        if (newDeser != deser) {
            prop = prop.withValueDeserializer(newDeser);
        }
    }
    return prop;
}
 
Example 2
Source File: PropertyBasedCreator.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Factory method used for building actual instances to be used with POJOS:
 * resolves deserializers, checks for "null values".
 *
 * @since 2.9
 */
public static PropertyBasedCreator construct(DeserializationContext ctxt,
        ValueInstantiator valueInstantiator, SettableBeanProperty[] srcCreatorProps,
        BeanPropertyMap allProperties)
    throws JsonMappingException
{
    final int len = srcCreatorProps.length;
    SettableBeanProperty[] creatorProps = new SettableBeanProperty[len];
    for (int i = 0; i < len; ++i) {
        SettableBeanProperty prop = srcCreatorProps[i];
        if (!prop.hasValueDeserializer()) {
            prop = prop.withValueDeserializer(ctxt.findContextualValueDeserializer(prop.getType(), prop));
        }
        creatorProps[i] = prop;
    }
    return new PropertyBasedCreator(ctxt, valueInstantiator, creatorProps,
            allProperties.isCaseInsensitive(),
            allProperties.hasAliases());
}
 
Example 3
Source File: PropertyBasedCreator.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Factory method used for building actual instances to be used with types
 * OTHER than POJOs.
 * resolves deserializers and checks for "null values".
 *
 * @since 2.9
 */
public static PropertyBasedCreator construct(DeserializationContext ctxt,
        ValueInstantiator valueInstantiator, SettableBeanProperty[] srcCreatorProps,
        boolean caseInsensitive)
    throws JsonMappingException
{
    final int len = srcCreatorProps.length;
    SettableBeanProperty[] creatorProps = new SettableBeanProperty[len];
    for (int i = 0; i < len; ++i) {
        SettableBeanProperty prop = srcCreatorProps[i];
        if (!prop.hasValueDeserializer()) {
            prop = prop.withValueDeserializer(ctxt.findContextualValueDeserializer(prop.getType(), prop));
        }
        creatorProps[i] = prop;
    }
    return new PropertyBasedCreator(ctxt, valueInstantiator, creatorProps, 
            caseInsensitive, false);
}
 
Example 4
Source File: UnwrappedPropertyHandler.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public UnwrappedPropertyHandler renameAll(NameTransformer transformer)
{
    ArrayList<SettableBeanProperty> newProps = new ArrayList<SettableBeanProperty>(_properties.size());
    for (SettableBeanProperty prop : _properties) {
        String newName = transformer.transform(prop.getName());
        prop = prop.withSimpleName(newName);
        JsonDeserializer<?> deser = prop.getValueDeserializer();
        if (deser != null) {
            @SuppressWarnings("unchecked")
            JsonDeserializer<Object> newDeser = (JsonDeserializer<Object>)
                deser.unwrappingDeserializer(transformer);
            if (newDeser != deser) {
                prop = prop.withValueDeserializer(newDeser);
            }
        }
        newProps.add(prop);
    }
    return new UnwrappedPropertyHandler(newProps);
}