本文整理匯總了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;
}