Skip to content

Commit

Permalink
JAVA-5774 Allow all property types for Filter.regex()
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Suhr committed Jan 29, 2025
1 parent 0e25654 commit 75bd37c
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexExt")
public infix fun KProperty<String?>.regex(pattern: String): Bson = Filters.regex(path(), pattern)
public infix fun <T> KProperty<T?>.regex(pattern: String): Bson = Filters.regex(path(), pattern)

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -444,7 +444,7 @@ public object Filters {
* @param pattern the pattern
* @return the filter
*/
public fun regex(property: KProperty<String?>, pattern: String): Bson = property.regex(pattern)
public fun <T> regex(property: KProperty<T?>, pattern: String): Bson = property.regex(pattern)

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -455,7 +455,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexExt")
public infix fun KProperty<String?>.regex(pattern: Pattern): Bson = Filters.regex(path(), pattern)
public infix fun <T> KProperty<T?>.regex(pattern: Pattern): Bson = Filters.regex(path(), pattern)

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -465,7 +465,7 @@ public object Filters {
* @param pattern the pattern
* @return the filter
*/
public fun regex(property: KProperty<String?>, pattern: Pattern): Bson = property.regex(pattern)
public fun <T> regex(property: KProperty<T?>, pattern: Pattern): Bson = property.regex(pattern)

/**
* Creates a filter that matches all documents where the value of the option matches the given regular expression
Expand All @@ -477,7 +477,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexExt")
public fun KProperty<String?>.regex(pattern: String, options: String): Bson =
public fun <T> KProperty<T?>.regex(pattern: String, options: String): Bson =
Filters.regex(path(), pattern, options)

/**
Expand All @@ -489,7 +489,7 @@ public object Filters {
* @param options the options
* @return the filter
*/
public fun regex(property: KProperty<String?>, pattern: String, options: String): Bson =
public fun <T> regex(property: KProperty<T?>, pattern: String, options: String): Bson =
property.regex(pattern, options)

/**
Expand All @@ -501,7 +501,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexExt")
public infix fun KProperty<String?>.regex(regex: Regex): Bson = Filters.regex(path(), regex.toPattern())
public infix fun <T> KProperty<T?>.regex(regex: Regex): Bson = Filters.regex(path(), regex.toPattern())

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -511,7 +511,7 @@ public object Filters {
* @param regex the regex
* @return the filter
*/
public fun regex(property: KProperty<String?>, regex: Regex): Bson = property.regex(regex.toPattern())
public fun <T> regex(property: KProperty<T?>, regex: Regex): Bson = property.regex(regex.toPattern())

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -522,7 +522,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterableExt")
public infix fun KProperty<Iterable<String?>>.regex(pattern: String): Bson = Filters.regex(path(), pattern)
public infix fun <T> KProperty<Iterable<T?>>.regex(pattern: String): Bson = Filters.regex(path(), pattern)

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -534,7 +534,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterable")
public fun regex(property: KProperty<Iterable<String?>>, pattern: String): Bson = property.regex(pattern)
public fun <T> regex(property: KProperty<Iterable<T?>>, pattern: String): Bson = property.regex(pattern)

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -545,7 +545,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterableExt")
public infix fun KProperty<Iterable<String?>>.regex(pattern: Pattern): Bson = Filters.regex(path(), pattern)
public infix fun <T> KProperty<Iterable<T?>>.regex(pattern: Pattern): Bson = Filters.regex(path(), pattern)

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -557,7 +557,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterable")
public fun regex(property: KProperty<Iterable<String?>>, pattern: Pattern): Bson = property.regex(pattern)
public fun <T> regex(property: KProperty<Iterable<T?>>, pattern: Pattern): Bson = property.regex(pattern)

/**
* Creates a filter that matches all documents where the value of the option matches the given regular expression
Expand All @@ -569,7 +569,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterableExt")
public fun KProperty<Iterable<String?>>.regex(regex: String, options: String): Bson =
public fun <T> KProperty<Iterable<T?>>.regex(regex: String, options: String): Bson =
Filters.regex(path(), regex, options)

/**
Expand All @@ -583,7 +583,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterable")
public fun regex(property: KProperty<Iterable<String?>>, regex: String, options: String): Bson =
public fun <T> regex(property: KProperty<Iterable<T?>>, regex: String, options: String): Bson =
property.regex(regex, options)

/**
Expand All @@ -595,7 +595,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterableExt")
public infix fun KProperty<Iterable<String?>>.regex(regex: Regex): Bson = Filters.regex(path(), regex.toPattern())
public infix fun <T> KProperty<Iterable<T?>>.regex(regex: Regex): Bson = Filters.regex(path(), regex.toPattern())

/**
* Creates a filter that matches all documents where the value of the property matches the given regular expression
Expand All @@ -607,7 +607,7 @@ public object Filters {
*/
@JvmSynthetic
@JvmName("regexIterable")
public fun regex(property: KProperty<Iterable<String?>>, regex: Regex): Bson = property.regex(regex.toPattern())
public fun <T> regex(property: KProperty<Iterable<T?>>, regex: Regex): Bson = property.regex(regex.toPattern())

/**
* Creates a filter that matches all documents matching the given the search term with the given text search
Expand Down

0 comments on commit 75bd37c

Please sign in to comment.