本文整理汇总了Java中com.fasterxml.jackson.core.JsonParser.nextIntValue方法的典型用法代码示例。如果您正苦于以下问题:Java JsonParser.nextIntValue方法的具体用法?Java JsonParser.nextIntValue怎么用?Java JsonParser.nextIntValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.fasterxml.jackson.core.JsonParser
的用法示例。
在下文中一共展示了JsonParser.nextIntValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFieldName
import com.fasterxml.jackson.core.JsonParser; //导入方法依赖的package包/类
static void parseFieldName(JsonParser parser, JsonParsingContext context) throws IOException {
String fieldName = parser.getCurrentName();
switch (fieldName) {
case "offset":
context.offset = parser.nextIntValue(-1);
context.doubleValues = null;
context.stringValues = null;
break;
case "uncompressedLength":
context.uncompressedLength = parser.nextIntValue(-1);
break;
case "stepLengths":
context.stepLengths = new TIntArrayList();
context.valuesOrLengthArray = true;
break;
case "values":
case "stepValues":
context.valuesOrLengthArray = true;
break;
default:
break;
}
}
示例2: deserialize
import com.fasterxml.jackson.core.JsonParser; //导入方法依赖的package包/类
@Override
public NetworkMetadata deserialize(JsonParser parser, DeserializationContext deserializationContext) throws IOException {
String id = null;
String sourceFormat = null;
DateTime caseDate = null;
int forecastDistance = 0;
List<Extension<NetworkMetadata>> extensions = Collections.emptyList();
while (parser.nextToken() != JsonToken.END_OBJECT) {
switch (parser.getCurrentName()) {
case "id":
id = parser.nextTextValue();
break;
case "sourceFormat":
sourceFormat = parser.nextTextValue();
break;
case "caseDate":
caseDate = DateTime.parse(parser.nextTextValue());
break;
case "forecastDistance":
forecastDistance = parser.nextIntValue(0);
break;
case "extensions":
parser.nextToken();
extensions = JsonUtil.readExtensions(parser, deserializationContext);
break;
default:
throw new PowsyblException("Unexpected field: " + parser.getCurrentName());
}
}
NetworkMetadata metadata = new NetworkMetadata(id, sourceFormat, caseDate, forecastDistance);
ExtensionSupplier.addExtensions(metadata, extensions);
return metadata;
}