Exemple #1
0
 public RequestSchemeMatchCondition(RequestSchemeMatchConditionType conditionType, RequestSchemeOperator requestSchemeOperator)
 {
     ConditionType         = conditionType;
     RequestSchemeOperator = requestSchemeOperator;
     Transforms            = new ChangeTrackingList <PreTransformCategory>();
     MatchValues           = new ChangeTrackingList <RequestSchemeMatchConditionMatchValue>();
 }
Exemple #2
0
 public RequestSchemeMatchConditionDefinition(RequestSchemeMatchConditionType typeDefinition, RequestSchemeOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator       = @operator;
     Transforms     = new ChangeTrackingList <PreTransformCategory>();
     MatchValues    = new ChangeTrackingList <RequestSchemeMatchConditionDefinitionMatchValue>();
 }
Exemple #3
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("typeName");
     writer.WriteStringValue(ConditionType.ToString());
     writer.WritePropertyName("operator");
     writer.WriteStringValue(RequestSchemeOperator.ToString());
     if (Optional.IsDefined(NegateCondition))
     {
         writer.WritePropertyName("negateCondition");
         writer.WriteBooleanValue(NegateCondition.Value);
     }
     if (Optional.IsCollectionDefined(Transforms))
     {
         writer.WritePropertyName("transforms");
         writer.WriteStartArray();
         foreach (var item in Transforms)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     if (Optional.IsCollectionDefined(MatchValues))
     {
         writer.WritePropertyName("matchValues");
         writer.WriteStartArray();
         foreach (var item in MatchValues)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
Exemple #4
0
 internal RequestSchemeMatchCondition(RequestSchemeMatchConditionType conditionType, RequestSchemeOperator requestSchemeOperator, bool?negateCondition, IList <PreTransformCategory> transforms, IList <RequestSchemeMatchConditionMatchValue> matchValues)
 {
     ConditionType         = conditionType;
     RequestSchemeOperator = requestSchemeOperator;
     NegateCondition       = negateCondition;
     Transforms            = transforms;
     MatchValues           = matchValues;
 }
Exemple #5
0
 internal RequestSchemeMatchConditionDefinition(RequestSchemeMatchConditionType typeDefinition, RequestSchemeOperator @operator, bool?negateCondition, IList <PreTransformCategory> transforms, IList <RequestSchemeMatchConditionDefinitionMatchValue> matchValues)
 {
     TypeDefinition  = typeDefinition;
     Operator        = @operator;
     NegateCondition = negateCondition;
     Transforms      = transforms;
     MatchValues     = matchValues;
 }
Exemple #6
0
        internal static RequestSchemeMatchCondition DeserializeRequestSchemeMatchCondition(JsonElement element)
        {
            RequestSchemeMatchConditionType typeName            = default;
            RequestSchemeOperator           @operator           = default;
            Optional <bool> negateCondition                     = default;
            Optional <IList <PreTransformCategory> > transforms = default;
            Optional <IList <RequestSchemeMatchConditionMatchValue> > matchValues = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new RequestSchemeMatchConditionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new RequestSchemeOperator(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("negateCondition"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    negateCondition = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("transforms"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <PreTransformCategory> array = new List <PreTransformCategory>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new PreTransformCategory(item.GetString()));
                    }
                    transforms = array;
                    continue;
                }
                if (property.NameEquals("matchValues"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <RequestSchemeMatchConditionMatchValue> array = new List <RequestSchemeMatchConditionMatchValue>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new RequestSchemeMatchConditionMatchValue(item.GetString()));
                    }
                    matchValues = array;
                    continue;
                }
            }
            return(new RequestSchemeMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(transforms), Optional.ToList(matchValues)));
        }