下面列出了com.fasterxml.jackson.databind.deser.SettableBeanProperty#withValueDeserializer ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
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;
}
/**
* 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());
}
/**
* 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);
}
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);
}