in src/main/java/org/apache/uima/json/jsoncas2/ser/FeatureStructureDeserializer.java [554:586]
private void deserializePrimitive(JsonParser aParser, DeserializationContext aCtxt,
FeatureStructure aFs, String aFeatureName, FieldType fieldType)
throws CASRuntimeException, IOException {
Feature feature = aFs.getType().getFeatureByBaseName(aFeatureName);
if (fieldType == FieldType.NUMBER) {
deserializeFloatingPointValue(aParser, aFs, feature);
return;
}
switch (aParser.currentToken()) {
case VALUE_NULL:
// No need do to anything really - we just leave the feature alone
break;
case VALUE_TRUE: // fall-through
case VALUE_FALSE:
aFs.setBooleanValue(feature, aParser.getBooleanValue());
break;
case VALUE_STRING:
aFs.setStringValue(feature, aParser.getValueAsString());
break;
case VALUE_NUMBER_FLOAT: // JSON does not distinguish between double and float
deserializeFloatingPointValue(aParser, aFs, feature);
break;
case VALUE_NUMBER_INT:
deserializeIntegerValue(aParser, aCtxt, aFs, feature, fieldType);
break;
default:
throw new JsonParseException(aParser,
"Expected a feature value as null, a boolean, string, or number but got "
+ aParser.currentToken());
}
}