当前位置: 首页>>代码示例>>Java>>正文


Java JsonToken.VALUE_NULL属性代码示例

本文整理汇总了Java中org.codehaus.jackson.JsonToken.VALUE_NULL属性的典型用法代码示例。如果您正苦于以下问题:Java JsonToken.VALUE_NULL属性的具体用法?Java JsonToken.VALUE_NULL怎么用?Java JsonToken.VALUE_NULL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.codehaus.jackson.JsonToken的用法示例。


在下文中一共展示了JsonToken.VALUE_NULL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readIndex

@Override
public int readIndex() throws IOException {
	advance(Symbol.UNION);
	Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol();
	
	String label;
	if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
		label = "null";
	} else if (in.getCurrentToken() == JsonToken.START_OBJECT &&
			in.nextToken() == JsonToken.FIELD_NAME) {
		label = in.getText();
		in.nextToken();
		parser.pushSymbol(Symbol.UNION_END);
	} else {
		throw error("start-union");
	}
	int n = a.findLabel(label);
	if (n < 0)
		throw new AvroTypeException("Unknown union branch " + label);
	parser.pushSymbol(a.getSymbol(n));
	return n;
}
 
开发者ID:Celos,项目名称:avro-json-decoder,代码行数:22,代码来源:ExtendedJsonDecoder.java

示例2: handleNonArray

private final Collection<String> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<String> paramCollection)
  throws IOException, JsonProcessingException
{
  if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
    throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
  JsonDeserializer localJsonDeserializer = this._valueDeserializer;
  if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
  {
    localObject = null;
    paramCollection.add(localObject);
    return paramCollection;
  }
  if (localJsonDeserializer == null);
  for (Object localObject = paramJsonParser.getText(); ; localObject = (String)localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext))
    break;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:16,代码来源:StringCollectionDeserializer.java

示例3: deserialize

@Override
public List<Date> deserialize( final JsonParser parser, final DeserializationContext context )
  throws IOException
{
  if ( !parser.isExpectedStartArrayToken() )
  {
    throw context.mappingException( List.class );
  }
  final ArrayList<Date> result = new ArrayList<Date>();

  final DateFormat formatter = DateUtil.newDateFormatter();
  JsonToken token;
  while ( JsonToken.END_ARRAY != ( token = parser.nextToken() ) )
  {
    if ( JsonToken.VALUE_NULL == token )
    {
      throw context.mappingException( List.class );
    }
    result.add( DateUtil.parse( formatter, parser.getText() ) );
  }
  return result;
}
 
开发者ID:realityforge,项目名称:gwt-datatypes,代码行数:22,代码来源:DateListDeserializer.java

示例4: deserialize

public EnumSet<?> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    throw paramDeserializationContext.mappingException(EnumSet.class);
  EnumSet localEnumSet = constructSet();
  while (true)
  {
    JsonToken localJsonToken = paramJsonParser.nextToken();
    if (localJsonToken == JsonToken.END_ARRAY)
      break;
    if (localJsonToken == JsonToken.VALUE_NULL)
      throw paramDeserializationContext.mappingException(this._enumClass);
    localEnumSet.add(this._enumDeserializer.deserialize(paramJsonParser, paramDeserializationContext));
  }
  return localEnumSet;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:17,代码来源:EnumSetDeserializer.java

示例5: _parseBooleanPrimitive

protected final boolean _parseBooleanPrimitive(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken = paramJsonParser.getCurrentToken();
  if (localJsonToken == JsonToken.VALUE_TRUE);
  while (true)
  {
    return true;
    if (localJsonToken == JsonToken.VALUE_FALSE)
      return false;
    if (localJsonToken == JsonToken.VALUE_NULL)
      return false;
    if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
      if (paramJsonParser.getIntValue() == 0)
        return false;
    if (localJsonToken != JsonToken.VALUE_STRING)
      break;
    String str = paramJsonParser.getText().trim();
    if ("true".equals(str))
      continue;
    if (("false".equals(str)) || (str.length() == 0))
      return Boolean.FALSE.booleanValue();
    throw paramDeserializationContext.weirdStringException(this._valueClass, "only \"true\" or \"false\" recognized");
  }
  throw paramDeserializationContext.mappingException(this._valueClass);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:26,代码来源:StdDeserializer.java

示例6: handleNonArray

private final Collection<Object> handleNonArray(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<Object> paramCollection)
  throws IOException, JsonProcessingException
{
  if (!paramDeserializationContext.isEnabled(DeserializationConfig.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY))
    throw paramDeserializationContext.mappingException(this._collectionType.getRawClass());
  JsonDeserializer localJsonDeserializer = this._valueDeserializer;
  TypeDeserializer localTypeDeserializer = this._valueTypeDeserializer;
  Object localObject;
  if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
    localObject = null;
  while (true)
  {
    paramCollection.add(localObject);
    return paramCollection;
    if (localTypeDeserializer == null)
    {
      localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
      continue;
    }
    localObject = localJsonDeserializer.deserializeWithType(paramJsonParser, paramDeserializationContext, localTypeDeserializer);
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:22,代码来源:CollectionDeserializer.java

示例7: deserializeUsingCustom

private Collection<String> deserializeUsingCustom(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<String> paramCollection)
  throws IOException, JsonProcessingException
{
  JsonDeserializer localJsonDeserializer = this._valueDeserializer;
  JsonToken localJsonToken = paramJsonParser.nextToken();
  if (localJsonToken != JsonToken.END_ARRAY)
  {
    if (localJsonToken == JsonToken.VALUE_NULL);
    for (Object localObject = null; ; localObject = (String)localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext))
    {
      paramCollection.add(localObject);
      break;
    }
  }
  return (Collection<String>)paramCollection;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:16,代码来源:StringCollectionDeserializer.java

示例8: deserialize

public Collection<String> deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Collection<String> paramCollection)
  throws IOException, JsonProcessingException
{
  if (!paramJsonParser.isExpectedStartArrayToken())
    paramCollection = handleNonArray(paramJsonParser, paramDeserializationContext, paramCollection);
  JsonToken localJsonToken;
  do
  {
    return paramCollection;
    if (!this._isDefaultDeserializer)
      return deserializeUsingCustom(paramJsonParser, paramDeserializationContext, paramCollection);
    localJsonToken = paramJsonParser.nextToken();
  }
  while (localJsonToken == JsonToken.END_ARRAY);
  if (localJsonToken == JsonToken.VALUE_NULL);
  for (Object localObject = null; ; localObject = paramJsonParser.getText())
  {
    paramCollection.add(localObject);
    break;
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:21,代码来源:StringCollectionDeserializer.java

示例9: deserializeAndSet

public final void deserializeAndSet(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext, Object paramObject)
  throws IOException, JsonProcessingException
{
  if (paramJsonParser.getCurrentToken() == JsonToken.VALUE_NULL)
    return;
  Object localObject;
  try
  {
    localObject = this._getter.invoke(paramObject, new Object[0]);
    if (localObject == null)
      throw new JsonMappingException("Problem deserializing 'setterless' property '" + getName() + "': get method returned null");
  }
  catch (Exception localException)
  {
    _throwAsIOE(localException);
    return;
  }
  this._valueDeserializer.deserialize(paramJsonParser, paramDeserializationContext, localObject);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:19,代码来源:SettableBeanProperty.java

示例10: readNull

@Override
public void readNull() throws IOException {
	advance(Symbol.NULL);
	if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
		in.nextToken();
	} else {
		throw error("null");
	}
}
 
开发者ID:Celos,项目名称:avro-json-decoder,代码行数:9,代码来源:ExtendedJsonDecoder.java

示例11: readNull

@Override
public void readNull() throws IOException {
  advance(Symbol.NULL);
  if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
    in.nextToken();
  } else {
    throw error("null");
  }
}
 
开发者ID:openaire,项目名称:iis,代码行数:9,代码来源:HackedJsonDecoder.java

示例12: readIndex

@Override
  public int readIndex() throws IOException {
    advance(Symbol.UNION);
    Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol();
    
    String label;
    if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
      label = "null";
    } else if (isUnionOfNullWithSomething(a)){
    	int nullN = a.findLabel("null");
    	int otherN = (nullN+1)%2;
//    	parser.pushSymbol(Symbol.UNION_END);
    	parser.pushSymbol(a.getSymbol(otherN));
    	return otherN;
    } else if (in.getCurrentToken() == JsonToken.START_OBJECT &&
               in.nextToken() == JsonToken.FIELD_NAME) {
      label = in.getText();
      in.nextToken();
      parser.pushSymbol(Symbol.UNION_END);
    } else {
      throw error("start-union");
    }
    int n = a.findLabel(label);
    if (n < 0)
      throw new AvroTypeException("Unknown union branch " + label);
    parser.pushSymbol(a.getSymbol(n));
    return n;
  }
 
开发者ID:openaire,项目名称:iis,代码行数:28,代码来源:HackedJsonDecoder.java

示例13: _parseBoolean

protected final Boolean _parseBoolean(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken = paramJsonParser.getCurrentToken();
  if (localJsonToken == JsonToken.VALUE_TRUE)
    return Boolean.TRUE;
  if (localJsonToken == JsonToken.VALUE_FALSE)
    return Boolean.FALSE;
  if (localJsonToken == JsonToken.VALUE_NULL)
    return null;
  if (localJsonToken == JsonToken.VALUE_NUMBER_INT)
  {
    if (paramJsonParser.getIntValue() == 0)
      return Boolean.FALSE;
    return Boolean.TRUE;
  }
  if (localJsonToken == JsonToken.VALUE_STRING)
  {
    String str = paramJsonParser.getText().trim();
    if ("true".equals(str))
      return Boolean.TRUE;
    if (("false".equals(str)) || (str.length() == 0))
      return Boolean.FALSE;
    throw paramDeserializationContext.weirdStringException(this._valueClass, "only \"true\" or \"false\" recognized");
  }
  throw paramDeserializationContext.mappingException(this._valueClass);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:27,代码来源:StdDeserializer.java

示例14: _readValue

protected Object _readValue(DeserializationConfig paramDeserializationConfig, JsonParser paramJsonParser, JavaType paramJavaType)
  throws IOException, JsonParseException, JsonMappingException
{
  JsonToken localJsonToken = _initForReading(paramJsonParser);
  if ((localJsonToken == JsonToken.VALUE_NULL) || (localJsonToken == JsonToken.END_ARRAY) || (localJsonToken == JsonToken.END_OBJECT));
  DeserializationContext localDeserializationContext;
  for (Object localObject = null; ; localObject = _findRootDeserializer(paramDeserializationConfig, paramJavaType).deserialize(paramJsonParser, localDeserializationContext))
  {
    paramJsonParser.clearCurrentToken();
    return localObject;
    localDeserializationContext = _createDeserializationContext(paramJsonParser, paramDeserializationConfig);
  }
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:ObjectMapper.java

示例15: _parseLong

protected final Long _parseLong(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
  throws IOException, JsonProcessingException
{
  JsonToken localJsonToken1 = paramJsonParser.getCurrentToken();
  Long localLong1;
  if ((localJsonToken1 == JsonToken.VALUE_NUMBER_INT) || (localJsonToken1 == JsonToken.VALUE_NUMBER_FLOAT))
    localLong1 = Long.valueOf(paramJsonParser.getLongValue());
  JsonToken localJsonToken2;
  do
  {
    while (true)
    {
      return localLong1;
      if (localJsonToken1 != JsonToken.VALUE_STRING)
        break;
      String str = paramJsonParser.getText().trim();
      int i = str.length();
      localLong1 = null;
      if (i == 0)
        continue;
      try
      {
        Long localLong2 = Long.valueOf(NumberInput.parseLong(str));
        return localLong2;
      }
      catch (IllegalArgumentException localIllegalArgumentException)
      {
        throw paramDeserializationContext.weirdStringException(this._valueClass, "not a valid Long value");
      }
    }
    localJsonToken2 = JsonToken.VALUE_NULL;
    localLong1 = null;
  }
  while (localJsonToken1 == localJsonToken2);
  throw paramDeserializationContext.mappingException(this._valueClass);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:36,代码来源:StdDeserializer.java


注:本文中的org.codehaus.jackson.JsonToken.VALUE_NULL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。