src/main/java/org/semgus/java/event/EventParser.java
private static SpecEvent parseDefineTermType(JSONObject eventDto) throws DeserializationException {
        String name = JsonUtils.getString(eventDto, "name");
        List<JSONObject> constructorsDto = JsonUtils.getObjects(eventDto, "constructors");

        // parse constructors definitions
        DefineTermTypeEvent.Constructor[] constructors = new DefineTermTypeEvent.Constructor[constructorsDto.size()];
        for (int i = 0; i < constructors.length; i++) {
            JSONObject constructorDto = constructorsDto.get(i);
            try {
                constructors[i] = new DefineTermTypeEvent.Constructor(
                        JsonUtils.getString(constructorDto, "name"),
                        JsonUtils.getStrings(constructorDto, "children"));
            } catch (DeserializationException e) {
                throw e.prepend("constructors." + i);
            }
        }

        return new DefineTermTypeEvent(name, Arrays.asList(constructors));
    }
/**
     * Deserializes a "define-term-type" event.
     *
     * @param eventDto The JSON representation of the event.
     * @return The deserialized event.
     * @throws DeserializationException If {@code eventDto} is not a valid representation of a "define-term-type" event.
     */
Deserializes a "define-term-type" event.
@param eventDto The JSON representation of the event.
@return The deserialized event.
@throws DeserializationException If  eventDto is not a valid representation of a "define-term-type" event.
Deserializes a " define - term - type " event . @param eventDto The JSON representation of the event . @return The deserialized event . @throws DeserializationException If eventDto is not a valid representation of a " define - term - type " event .
private static SpecEvent parseDefineTermType(JSONObject eventDto) throws DeserializationException {
        String name = JsonUtils.getString(eventDto, "name");
        List<JSONObject> constructorsDto = JsonUtils.getObjects(eventDto, "constructors");
        DefineTermTypeEvent.Constructor[] constructors = new DefineTermTypeEvent.Constructor[constructorsDto.size()];
        for (int i = 0; i < constructors.length; i++) {
            JSONObject constructorDto = constructorsDto.get(i);
            try {
                constructors[i] = new DefineTermTypeEvent.Constructor(
                        JsonUtils.getString(constructorDto, "name"),
                        JsonUtils.getStrings(constructorDto, "children"));
            } catch (DeserializationException e) {
                throw e.prepend("constructors." + i);
            }
        }
        return new DefineTermTypeEvent(name, Arrays.asList(constructors));
    }
private static SpecEvent parseDefineTermType ( JSONObject eventDto ) throws DeserializationException { String name = JsonUtils . getString ( eventDto , "name" ) ; List < JSONObject > constructorsDto = JsonUtils . getObjects ( eventDto , "constructors" ) ; DefineTermTypeEvent . Constructor [ ] constructors = new DefineTermTypeEvent . Constructor [ constructorsDto . size ( ) ] ; for ( int i = 0 ; i < constructors . length ; i ++ ) { JSONObject constructorDto = constructorsDto . get ( i ) ; try { constructors [ i ] = new DefineTermTypeEvent . Constructor ( JsonUtils . getString ( constructorDto , "name" ) , JsonUtils . getStrings ( constructorDto , "children" ) ) ; } catch ( DeserializationException e ) { throw e . prepend ( "constructors." + i ) ; } } return new DefineTermTypeEvent ( name , Arrays . asList ( constructors ) ) ; }
Deserializes a "define-term-type" event.
Deserializes a " define - term - type " event .
// parse constructors definitions