public ServerPortMatchConditionDefinition(ServerPortMatchConditionType typeDefinition, ServerPortOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator       = @operator;
     MatchValues    = new ChangeTrackingList <string>();
     Transforms     = new ChangeTrackingList <PreTransformCategory>();
 }
Пример #2
0
 public ServerPortMatchCondition(ServerPortMatchConditionType conditionType, ServerPortOperator serverPortOperator)
 {
     ConditionType      = conditionType;
     ServerPortOperator = serverPortOperator;
     MatchValues        = new ChangeTrackingList <string>();
     Transforms         = new ChangeTrackingList <PreTransformCategory>();
 }
 internal ServerPortMatchConditionDefinition(ServerPortMatchConditionType typeDefinition, ServerPortOperator @operator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     TypeDefinition  = typeDefinition;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
Пример #4
0
 internal ServerPortMatchCondition(ServerPortMatchConditionType conditionType, ServerPortOperator serverPortOperator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     ConditionType      = conditionType;
     ServerPortOperator = serverPortOperator;
     NegateCondition    = negateCondition;
     MatchValues        = matchValues;
     Transforms         = transforms;
 }
Пример #5
0
        internal static ServerPortMatchCondition DeserializeServerPortMatchCondition(JsonElement element)
        {
            ServerPortMatchConditionType typeName               = default;
            ServerPortOperator           @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 ServerPortMatchConditionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new ServerPortOperator(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 ServerPortMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }