本文整理匯總了Java中org.codehaus.jackson.map.DeserializationContext.wrongTokenException方法的典型用法代碼示例。如果您正苦於以下問題:Java DeserializationContext.wrongTokenException方法的具體用法?Java DeserializationContext.wrongTokenException怎麽用?Java DeserializationContext.wrongTokenException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.codehaus.jackson.map.DeserializationContext
的用法示例。
在下文中一共展示了DeserializationContext.wrongTokenException方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: _deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
private final Object _deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
Object localObject = _findDeserializer(paramDeserializationContext, _locateTypeId(paramJsonParser, paramDeserializationContext)).deserialize(paramJsonParser, paramDeserializationContext);
if (paramJsonParser.nextToken() != JsonToken.END_ARRAY)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.END_ARRAY, "expected closing END_ARRAY after type information and deserialized value");
return localObject;
}
示例2: _locateTypeId
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
protected final String _locateTypeId(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (!paramJsonParser.isExpectedStartArrayToken())
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.START_ARRAY, "need JSON Array to contain As.WRAPPER_ARRAY type information for class " + baseTypeName());
if (paramJsonParser.nextToken() != JsonToken.VALUE_STRING)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.VALUE_STRING, "need JSON String that contains type id (for subtype of " + baseTypeName() + ")");
String str = paramJsonParser.getText();
paramJsonParser.nextToken();
return str;
}
示例3: _deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
private final Object _deserialize(JsonParser paramJsonParser, DeserializationContext paramDeserializationContext)
throws IOException, JsonProcessingException
{
if (paramJsonParser.getCurrentToken() != JsonToken.START_OBJECT)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.START_OBJECT, "need JSON Object to contain As.WRAPPER_OBJECT type information for class " + baseTypeName());
if (paramJsonParser.nextToken() != JsonToken.FIELD_NAME)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.FIELD_NAME, "need JSON String that contains type id (for subtype of " + baseTypeName() + ")");
JsonDeserializer localJsonDeserializer = _findDeserializer(paramDeserializationContext, paramJsonParser.getText());
paramJsonParser.nextToken();
Object localObject = localJsonDeserializer.deserialize(paramJsonParser, paramDeserializationContext);
if (paramJsonParser.nextToken() != JsonToken.END_OBJECT)
throw paramDeserializationContext.wrongTokenException(paramJsonParser, JsonToken.END_OBJECT, "expected closing END_OBJECT after type information and deserialized value");
return localObject;
}
示例4: deserialize
import org.codehaus.jackson.map.DeserializationContext; //導入方法依賴的package包/類
@Override public CollectionPage<?> deserialize(final JsonParser jp,
final DeserializationContext ctxt) throws IOException {
final ObjectMapper codec = (ObjectMapper) jp.getCodec();
final List<Object> objects = new ArrayList<Object>();
final List<Link> links = new ArrayList<Link>();
Integer total = null;
JsonToken jsonToken = jp.getCurrentToken();
if (START_OBJECT.equals(jsonToken)) {
while (null != (jsonToken = jp.nextToken())) {
if (FIELD_NAME.equals(jsonToken)) {
final String currentName = jp.getCurrentName();
if ("links".equals(currentName)) {
jsonToken = jp.nextToken();
if (START_ARRAY.equals(jsonToken)) {
while (START_OBJECT.equals(jp.nextToken())) {
links.add(codec.readValue(jp, Link.class));
}
}
} else if ("total".equals(currentName)) {
jp.nextToken();
total = codec.readValue(jp, Integer.class);
} else if ("values".equals(currentName)) {
jp.nextToken();
final Collection<Object> deserializedObjects = deserializeValues(jp, codec);
objects.addAll(deserializedObjects);
}
}
}
return new CollectionPage<Object>(objects,
getSelf(links),
getNextPage(links),
getPreviousPage(links),
total);
}
throw ctxt.wrongTokenException(jp, START_OBJECT, "Input JSON could not be deserialized to CollectionPage");
}