Beispiel #1
0
    public static InformationNuggetIntentJSON createForKey(string key, Dictionary <string, JSONValue> other_field_index)
    {
        switch (key[0])
        {
        case 'H':
            if ((String.Compare(key, 1, "oundWeather", 0, 11, false) == 0) && (key.Length == 12))
            {
                return(new HoundWeatherInformationNuggetIntentJSON());
            }
            break;

        case 'U':
            if ((String.Compare(key, 1, "serMemory", 0, 9, false) == 0) && (key.Length == 10))
            {
                JSONValue key_value = ((other_field_index == null) ? null : (other_field_index.ContainsKey("UserMemoryIntentKind") ? other_field_index["UserMemoryIntentKind"] : null));
                if (key_value == null)
                {
                    throw new Exception("The `UserMemoryIntentKind' field is missing.");
                }
                JSONStringValue key_string_value = key_value.string_value();
                if (key_string_value == null)
                {
                    throw new Exception("The `UserMemoryIntentKind' field has a non-string value.");
                }
                return(UserMemoryIntentJSON.createForKey(key_string_value.getData(), other_field_index));
            }
            break;

        case 'W':
            if ((String.Compare(key, 1, "eather", 0, 6, false) == 0) && (key.Length == 7))
            {
                return(new WeatherInformationNuggetIntentJSON());
            }
            break;

        default:
            break;
        }

        return(new GenericInformationNuggetIntentJSON(key));
    }