예제 #1
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("typeName");
     writer.WriteStringValue(ConditionType.ToString());
     writer.WritePropertyName("operator");
     writer.WriteStringValue(IsDeviceOperator.ToString());
     if (Optional.IsDefined(NegateCondition))
     {
         writer.WritePropertyName("negateCondition");
         writer.WriteBooleanValue(NegateCondition.Value);
     }
     if (Optional.IsCollectionDefined(MatchValues))
     {
         writer.WritePropertyName("matchValues");
         writer.WriteStartArray();
         foreach (var item in MatchValues)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     if (Optional.IsCollectionDefined(Transforms))
     {
         writer.WritePropertyName("transforms");
         writer.WriteStartArray();
         foreach (var item in Transforms)
         {
             writer.WriteStringValue(item.ToString());
         }
         writer.WriteEndArray();
     }
     writer.WriteEndObject();
 }
예제 #2
0
 public IsDeviceMatchCondition(IsDeviceMatchConditionType conditionType, IsDeviceOperator isDeviceOperator)
 {
     ConditionType    = conditionType;
     IsDeviceOperator = isDeviceOperator;
     MatchValues      = new ChangeTrackingList <IsDeviceMatchConditionMatchValue>();
     Transforms       = new ChangeTrackingList <PreTransformCategory>();
 }
 public IsDeviceMatchConditionParameters(IsDeviceMatchConditionParametersTypeName typeName, IsDeviceOperator @operator)
 {
     TypeName    = typeName;
     Operator    = @operator;
     MatchValues = new ChangeTrackingList <IsDeviceMatchConditionParametersMatchValuesItem>();
     Transforms  = new ChangeTrackingList <TransformCategory>();
 }
예제 #4
0
 public IsDeviceMatchConditionDefinition(IsDeviceMatchConditionType typeDefinition, IsDeviceOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator       = @operator;
     MatchValues    = new ChangeTrackingList <IsDeviceMatchConditionDefinitionMatchValue>();
     Transforms     = new ChangeTrackingList <PreTransformCategory>();
 }
예제 #5
0
 internal IsDeviceMatchCondition(IsDeviceMatchConditionType conditionType, IsDeviceOperator isDeviceOperator, bool?negateCondition, IList <IsDeviceMatchConditionMatchValue> matchValues, IList <PreTransformCategory> transforms)
 {
     ConditionType    = conditionType;
     IsDeviceOperator = isDeviceOperator;
     NegateCondition  = negateCondition;
     MatchValues      = matchValues;
     Transforms       = transforms;
 }
 internal IsDeviceMatchConditionParameters(IsDeviceMatchConditionParametersTypeName typeName, IsDeviceOperator @operator, bool?negateCondition, IList <IsDeviceMatchConditionParametersMatchValuesItem> matchValues, IList <TransformCategory> transforms)
 {
     TypeName        = typeName;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
예제 #7
0
 internal IsDeviceMatchConditionDefinition(IsDeviceMatchConditionType typeDefinition, IsDeviceOperator @operator, bool?negateCondition, IList <IsDeviceMatchConditionDefinitionMatchValue> matchValues, IList <PreTransformCategory> transforms)
 {
     TypeDefinition  = typeDefinition;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
예제 #8
0
        internal static IsDeviceMatchCondition DeserializeIsDeviceMatchCondition(JsonElement element)
        {
            IsDeviceMatchConditionType typeName        = default;
            IsDeviceOperator           @operator       = default;
            Optional <bool>            negateCondition = default;
            Optional <IList <IsDeviceMatchConditionMatchValue> > matchValues = default;
            Optional <IList <PreTransformCategory> >             transforms  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new IsDeviceMatchConditionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new IsDeviceOperator(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 <IsDeviceMatchConditionMatchValue> array = new List <IsDeviceMatchConditionMatchValue>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new IsDeviceMatchConditionMatchValue(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 IsDeviceMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }