Skip to content

Commit

Permalink
Null check for adding operators (#8791)
Browse files Browse the repository at this point in the history
* WIP

* Updating test cases

* Adding null check for collection

* Review comments

* Review comments implemented

* Removing redundant ref
  • Loading branch information
anshuldavid13 committed Jun 22, 2022
1 parent c471214 commit daf7776
Showing 1 changed file with 12 additions and 6 deletions.
Expand Up @@ -76,19 +76,25 @@ public static Filter And(IEnumerable<Filter> filters)
/// Creates a filter to check that the specified property is in a given array of values.
/// </summary>
/// <param name="value">The name of the property. Must not be null.</param>
/// <param name="collection">The array of values to compare against. </param>
/// <param name="collection">The array of values to compare against. Must not be null. </param>
/// <returns>The newly created filter.</returns>
public static Filter In(string value, ArrayValue collection) =>
Property(value, collection, Operator.In);
public static Filter In(string value, ArrayValue collection)
{
GaxPreconditions.CheckNotNull(collection, nameof(collection));
return Property(value, collection, Operator.In);
}

/// <summary>
/// Creates a filter to check that the specified property is not in a given array of values.
/// </summary>
/// <param name="value">The name of the property. Must not be null.</param>
/// <param name="collection">The array of values to compare against. </param>
/// <param name="collection">The array of values to compare against. Must not be null.</param>
/// <returns>The newly created filter.</returns>
public static Filter NotIn(string value, ArrayValue collection) =>
Property(value, collection, Operator.NotIn);
public static Filter NotIn(string value, ArrayValue collection)
{
GaxPreconditions.CheckNotNull(collection, nameof(collection));
return Property(value, collection, Operator.NotIn);
}

/// <summary>
/// Creates a filter to check that the specified property is less than a given value.
Expand Down

0 comments on commit daf7776

Please sign in to comment.