本文整理汇总了Java中com.fasterxml.jackson.databind.JsonDeserializer.getNullValue方法的典型用法代码示例。如果您正苦于以下问题:Java JsonDeserializer.getNullValue方法的具体用法?Java JsonDeserializer.getNullValue怎么用?Java JsonDeserializer.getNullValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.databind.JsonDeserializer
的用法示例。
在下文中一共展示了JsonDeserializer.getNullValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: _deserializeContents
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected T _deserializeContents(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonDeserializer<?> valueDes = valueDeserializer;
JsonToken t;
final TypeDeserializer typeDeser = typeDeserializerForValue;
CollectionF<Object> collection = newInstance();
while ((t = jp.nextToken()) != JsonToken.END_ARRAY) {
Object value;
if (t == JsonToken.VALUE_NULL) {
value = valueDes.getNullValue();
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
collection.add(value);
}
return (T) collection.unmodifiable();
}
示例2: _deserializeSingle
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
protected T _deserializeSingle(JsonParser jp, DeserializationContext ctxt) throws IOException {
JsonDeserializer<?> valueDes = valueDeserializer;
final TypeDeserializer typeDeser = typeDeserializerForValue;
CollectionF<Object> collection = newInstance();
Object value;
if (jp.getCurrentToken() == JsonToken.VALUE_NULL) {
value = valueDes.getNullValue();
} else if (typeDeser == null) {
value = valueDes.deserialize(jp, ctxt);
} else {
value = valueDes.deserializeWithType(jp, ctxt, typeDeser);
}
collection.add(value);
return (T) collection.unmodifiable();
}
示例3: deserialize
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
@Override
public T deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
JsonDeserializer<?> deserializer = deserializer(0);
List<Object> list = new ArrayList<>();
if (!p.isExpectedStartArrayToken()) {
throw mappingException(ctxt, valueType.getRawClass(), p.getCurrentToken());
}
for (JsonToken jsonToken = p.nextToken(); jsonToken != END_ARRAY; jsonToken = p.nextToken()) {
Object value = (jsonToken != VALUE_NULL) ? deserializer.deserialize(p, ctxt) : deserializer.getNullValue(ctxt);
list.add(value);
}
return create(list, ctxt);
}
示例4: deserialize
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
@Override
public Tuple deserialize(JsonParser p, DeserializationContext ctxt) throws IOException {
List<Object> list = new ArrayList<>();
int ptr = 0;
for (JsonToken jsonToken = p.nextToken(); jsonToken != END_ARRAY; jsonToken = p.nextToken()) {
if (ptr >= deserializersCount()) {
throw mappingException(ctxt, javaType.getRawClass(), jsonToken);
}
JsonDeserializer<?> deserializer = deserializer(ptr++);
Object value = (jsonToken != VALUE_NULL) ? deserializer.deserialize(p, ctxt) : deserializer.getNullValue(ctxt);
list.add(value);
}
return create(list, ctxt);
}
示例5: SettableBeanProperty
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
public SettableBeanProperty(SettableBeanProperty paramSettableBeanProperty, JsonDeserializer<?> paramJsonDeserializer)
{
this._propName = paramSettableBeanProperty._propName;
this._type = paramSettableBeanProperty._type;
this._wrapperName = paramSettableBeanProperty._wrapperName;
this._isRequired = paramSettableBeanProperty._isRequired;
this._contextAnnotations = paramSettableBeanProperty._contextAnnotations;
this._valueTypeDeserializer = paramSettableBeanProperty._valueTypeDeserializer;
this._managedReferenceName = paramSettableBeanProperty._managedReferenceName;
this._propertyIndex = paramSettableBeanProperty._propertyIndex;
if (paramJsonDeserializer == null)
{
this._nullProvider = null;
this._valueDeserializer = MISSING_VALUE_DESERIALIZER;
}
else
{
Object localObject = paramJsonDeserializer.getNullValue();
NullProvider localNullProvider;
if (localObject == null)
localNullProvider = null;
else
localNullProvider = new NullProvider(this._type, localObject);
this._nullProvider = localNullProvider;
this._valueDeserializer = paramJsonDeserializer;
}
this._viewMatcher = paramSettableBeanProperty._viewMatcher;
}
示例6: construct
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
public static PropertyBasedCreator construct(DeserializationContext paramDeserializationContext, ValueInstantiator paramValueInstantiator, SettableBeanProperty[] paramArrayOfSettableBeanProperty)
{
int i = paramArrayOfSettableBeanProperty.length;
SettableBeanProperty[] arrayOfSettableBeanProperty = new SettableBeanProperty[i];
Object[] arrayOfObject = null;
for (int j = 0; j < i; j++)
{
SettableBeanProperty localSettableBeanProperty1 = paramArrayOfSettableBeanProperty[j];
SettableBeanProperty localSettableBeanProperty2 = localSettableBeanProperty1;
if (!localSettableBeanProperty1.hasValueDeserializer())
localSettableBeanProperty2 = localSettableBeanProperty2.withValueDeserializer(paramDeserializationContext.findContextualValueDeserializer(localSettableBeanProperty2.getType(), localSettableBeanProperty2));
arrayOfSettableBeanProperty[j] = localSettableBeanProperty2;
JsonDeserializer localJsonDeserializer = localSettableBeanProperty2.getValueDeserializer();
Object localObject1;
if (localJsonDeserializer == null)
localObject1 = null;
else
localObject1 = localJsonDeserializer.getNullValue();
Object localObject2 = localObject1;
if ((localObject1 == null) && (localSettableBeanProperty2.getType().isPrimitive()))
localObject2 = ClassUtil.defaultValue(localSettableBeanProperty2.getType().getRawClass());
if (localObject2 != null)
{
if (arrayOfObject == null)
arrayOfObject = new Object[i];
arrayOfObject[j] = localObject2;
}
}
return new PropertyBasedCreator(paramValueInstantiator, arrayOfSettableBeanProperty, arrayOfObject);
}
示例7: deserializeElement
import com.fasterxml.jackson.databind.JsonDeserializer; //导入方法依赖的package包/类
private Object deserializeElement(JsonDeserializer<?> deserializer, TypeDeserializer typeDeserializer,
JsonParser parser, DeserializationContext context) throws IOException
{
if (parser.getCurrentToken() == JsonToken.VALUE_NULL) {
return deserializer.getNullValue();
} else if (typeDeserializer == null) {
return deserializer.deserialize(parser, context);
}
return deserializer.deserializeWithType(parser, context, typeDeserializer);
}