# RestrictionAllowlist.Builder

Artifact: [androidx.webkit:webkit](https://developer.android.com/jetpack/androidx/releases/webkit) [View Source](https://cs.android.com/search?q=file:androidx/webkit/RestrictionAllowlist.java+class:androidx.webkit.RestrictionAllowlist.Builder) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

*** ** * ** ***


```
class RestrictionAllowlist.Builder
```

<br />

*** ** * ** ***

RestrictionAllowlist builder. Add the RestrictionAllowlist produced to a WebView via `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewBuilder#addAllowlist(androidx.webkit.RestrictionAllowlist)`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/RestrictionAllowlist.Builder#Builder(java.util.Set<java.lang.String>)(originPatterns: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>)` Construct a RestrictionAllowlist Builder |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/RestrictionAllowlist.Builder` | `https://developer.android.com/reference/kotlin/androidx/webkit/RestrictionAllowlist.Builder#addJavaScriptInterface(java.lang.Object,java.lang.String)(object: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` This API is the same as `https://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)` except it will only inject the interface into the origin patterns allowed. |
| `https://developer.android.com/reference/kotlin/androidx/webkit/RestrictionAllowlist` | `https://developer.android.com/reference/kotlin/androidx/webkit/RestrictionAllowlist.Builder#build()()` Constructs a new RestrictionAllowlist that can be attached via `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewBuilder#addAllowlist(androidx.webkit.RestrictionAllowlist)`. |

## Public constructors

### Builder

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
Builder(originPatterns: (Mutable)Set<String>)
```

Construct a RestrictionAllowlist Builder

See `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewCompat#addWebMessageListener(android.webkit.WebView,java.lang.String,java.util.Set<java.lang.String>,androidx.webkit.WebViewCompat.WebMessageListener)` for the rules of the `originPatterns` parameter.

| Parameters |
|---|---|
| `originPatterns: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>` | List of origin patterns to allow the selected behaviors on. |

## Public functions

### addJavaScriptInterface

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
fun addJavaScriptInterface(object: Any, name: String): RestrictionAllowlist.Builder
```

This API is the same as `https://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object, java.lang.String)` except it will only inject the interface into the origin patterns allowed.

A `name` value may only be used once per WebViewBuilder, regardless of whether it's the same, a different, or an equivalent allowlist.

### build

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/webkit#1.15.0)

```
fun build(): RestrictionAllowlist
```

Constructs a new RestrictionAllowlist that can be attached via `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewBuilder#addAllowlist(androidx.webkit.RestrictionAllowlist)`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/webkit/WebViewBuilder` |   |