本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例10: readNull
@Override
public void readNull() throws IOException {
advance(Symbol.NULL);
if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
in.nextToken();
} else {
throw error("null");
}
}
示例11: readNull
@Override
public void readNull() throws IOException {
advance(Symbol.NULL);
if (in.getCurrentToken() == JsonToken.VALUE_NULL) {
in.nextToken();
} else {
throw error("null");
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}