當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonDeserializer.getNullValue方法代碼示例

本文整理匯總了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();
}
 
開發者ID:v1ctor,項目名稱:jackson-datatype-bolts,代碼行數:22,代碼來源:CollectionDeserializer.java

示例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();
}
 
開發者ID:v1ctor,項目名稱:jackson-datatype-bolts,代碼行數:19,代碼來源:CollectionDeserializer.java

示例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);
}
 
開發者ID:vavr-io,項目名稱:vavr-jackson,代碼行數:14,代碼來源:ArrayDeserializer.java

示例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);
}
 
開發者ID:vavr-io,項目名稱:vavr-jackson,代碼行數:16,代碼來源:TupleDeserializer.java

示例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;
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:29,代碼來源:SettableBeanProperty.java

示例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);
}
 
開發者ID:mmmsplay10,項目名稱:QuizUpWinner,代碼行數:31,代碼來源:PropertyBasedCreator.java

示例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);
}
 
開發者ID:v1ctor,項目名稱:jackson-datatype-bolts,代碼行數:11,代碼來源:Tuple2Deserializer.java


注:本文中的com.fasterxml.jackson.databind.JsonDeserializer.getNullValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。