in src/main/java/org/apache/uima/json/jsoncas2/ser/FeatureDeserializer.java [47:74]
public FeatureDescription deserialize(JsonParser aParser, DeserializationContext aCtxt)
throws IOException, JsonProcessingException {
JsonNode node = aParser.readValueAsTree();
if (!node.isObject()) {
throw new JsonParseException(aParser, "Feature declaration must be a JSON object");
}
String featureName = node.get(NAME_FIELD).asText();
String featureRangeType = node.get(RANGE_FIELD).asText();
Optional<String> componentType;
if (featureRangeType.endsWith(ARRAY_SUFFIX)) {
componentType = Optional
.of(featureRangeType.substring(0, featureRangeType.length() - ARRAY_SUFFIX.length()));
featureRangeType = CAS.TYPE_NAME_FS_ARRAY;
} else {
componentType = Optional.ofNullable(node.get(ELEMENT_TYPE_FIELD)).map(JsonNode::asText);
}
FeatureDescription fd = UIMAFramework.getResourceSpecifierFactory().createFeatureDescription();
fd.setName(featureName);
fd.setRangeTypeName(featureRangeType);
fd.setElementType(componentType.orElse(null));
// fd.setMultipleReferencesAllowed();
// fd.setDescription("");
// td.setSourceUrl(aParser.getTokenLocation().sourceDescription());
return fd;
}