Esempio n. 1
0
 public PostArgsMatchConditionDefinition(PostArgsMatchConditionType typeDefinition, PostArgsOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator       = @operator;
     MatchValues    = new ChangeTrackingList <string>();
     Transforms     = new ChangeTrackingList <PreTransformCategory>();
 }
Esempio n. 2
0
 public PostArgsMatchCondition(PostArgsMatchConditionType conditionType, PostArgsOperator postArgsOperator)
 {
     ConditionType    = conditionType;
     PostArgsOperator = postArgsOperator;
     MatchValues      = new ChangeTrackingList <string>();
     Transforms       = new ChangeTrackingList <PreTransformCategory>();
 }
Esempio n. 3
0
 internal PostArgsMatchConditionDefinition(PostArgsMatchConditionType typeDefinition, string selector, PostArgsOperator @operator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     TypeDefinition  = typeDefinition;
     Selector        = selector;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
Esempio n. 4
0
 internal PostArgsMatchCondition(PostArgsMatchConditionType conditionType, string selector, PostArgsOperator postArgsOperator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     ConditionType    = conditionType;
     Selector         = selector;
     PostArgsOperator = postArgsOperator;
     NegateCondition  = negateCondition;
     MatchValues      = matchValues;
     Transforms       = transforms;
 }
        internal static PostArgsMatchConditionDefinition DeserializePostArgsMatchConditionDefinition(JsonElement element)
        {
            PostArgsMatchConditionType typeName                 = default;
            Optional <string>          selector                 = default;
            PostArgsOperator           @operator                = default;
            Optional <bool>            negateCondition          = default;
            Optional <IList <string> > matchValues              = default;
            Optional <IList <PreTransformCategory> > transforms = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new PostArgsMatchConditionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("selector"))
                {
                    selector = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new PostArgsOperator(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("matchValues"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    matchValues = array;
                    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;
                }
            }
            return(new PostArgsMatchConditionDefinition(typeName, selector.Value, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }