public TypeDescription deserialize()

in src/main/java/org/apache/uima/json/jsoncas2/ser/TypeDeserializer.java [44:72]


  public TypeDescription deserialize(JsonParser aParser, DeserializationContext aCtxt)
          throws IOException, JsonProcessingException {
    JsonNode node = aParser.readValueAsTree();

    if (!node.isObject()) {
      throw new JsonParseException(aParser, "Type system declaration must be a JSON object");
    }

    String typeName = node.get(JsonCas2Names.NAME_FIELD).asText();
    String parentTypeName = node.get(JsonCas2Names.SUPER_TYPE_FIELD).asText();
    Optional<String> componentType = Optional.ofNullable(node.get(JsonCas2Names.ELEMENT_TYPE_FIELD))
            .map(JsonNode::asText);

    List<String> featureNames = new ArrayList<>();
    node.fieldNames().forEachRemaining(name -> {
      if (!name.startsWith(JsonCas2Names.RESERVED_FIELD_PREFIX)) {
        featureNames.add(name);
      }
    });

    TypeDescription td = UIMAFramework.getResourceSpecifierFactory().createTypeDescription();
    td.setName(typeName);
    td.setSupertypeName(parentTypeName);
    // td.setDescription("");
    // td.setAllowedValues(null);
    // td.setFeatures(null);
    // td.setSourceUrl(aParser.getTokenLocation().sourceDescription());
    return td;
  }