예제 #1
0
 void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("typeName");
     writer.WriteStringValue(ConditionType.ToString());
     writer.WritePropertyName("operator");
     writer.WriteStringValue(RemoteAddressOperator.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);
         }
         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 RemoteAddressMatchConditionParameters(RemoteAddressMatchConditionParametersOdataType odataType, RemoteAddressOperator @operator)
 {
     OdataType   = odataType;
     Operator    = @operator;
     MatchValues = new ChangeTrackingList <string>();
     Transforms  = new ChangeTrackingList <TransformCategory>();
 }
예제 #3
0
 public RemoteAddressMatchCondition(RemoteAddressMatchConditionType conditionType, RemoteAddressOperator remoteAddressOperator)
 {
     ConditionType         = conditionType;
     RemoteAddressOperator = remoteAddressOperator;
     MatchValues           = new ChangeTrackingList <string>();
     Transforms            = new ChangeTrackingList <PreTransformCategory>();
 }
 public RemoteAddressMatchConditionDefinition(RemoteAddressMatchConditionType typeDefinition, RemoteAddressOperator @operator)
 {
     TypeDefinition = typeDefinition;
     Operator = @operator;
     MatchValues = new ChangeTrackingList<string>();
     Transforms = new ChangeTrackingList<PreTransformCategory>();
 }
예제 #5
0
 internal RemoteAddressMatchConditionParameters(RemoteAddressMatchConditionParametersOdataType odataType, RemoteAddressOperator @operator, bool?negateCondition, IList <string> matchValues, IList <TransformCategory> transforms)
 {
     OdataType       = odataType;
     Operator        = @operator;
     NegateCondition = negateCondition;
     MatchValues     = matchValues;
     Transforms      = transforms;
 }
예제 #6
0
 internal RemoteAddressMatchCondition(RemoteAddressMatchConditionType conditionType, RemoteAddressOperator remoteAddressOperator, bool?negateCondition, IList <string> matchValues, IList <PreTransformCategory> transforms)
 {
     ConditionType         = conditionType;
     RemoteAddressOperator = remoteAddressOperator;
     NegateCondition       = negateCondition;
     MatchValues           = matchValues;
     Transforms            = transforms;
 }
 internal RemoteAddressMatchConditionDefinition(RemoteAddressMatchConditionType typeDefinition, RemoteAddressOperator @operator, bool? negateCondition, IList<string> matchValues, IList<PreTransformCategory> transforms)
 {
     TypeDefinition = typeDefinition;
     Operator = @operator;
     NegateCondition = negateCondition;
     MatchValues = matchValues;
     Transforms = transforms;
 }
예제 #8
0
        internal static RemoteAddressMatchCondition DeserializeRemoteAddressMatchCondition(JsonElement element)
        {
            RemoteAddressMatchConditionType typeName            = default;
            RemoteAddressOperator           @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 RemoteAddressMatchConditionType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("operator"))
                {
                    @operator = new RemoteAddressOperator(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 RemoteAddressMatchCondition(typeName, @operator, Optional.ToNullable(negateCondition), Optional.ToList(matchValues), Optional.ToList(transforms)));
        }