# 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)

*** ** * ** ***


```
public final class RestrictionAllowlist.Builder
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist.Builder#Builder(java.util.Set<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html> originPatterns)` Construct a RestrictionAllowlist Builder |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist.Builder` | `https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist.Builder#addJavaScriptInterface(java.lang.Object,java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Object.html object, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html name)` 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://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist` | `https://developer.android.com/reference/androidx/webkit/RestrictionAllowlist.Builder#build()()` Constructs a new RestrictionAllowlist that can be attached via `https://developer.android.com/reference/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)

```
public Builder(@NonNull Set<@NonNull String> originPatterns)
```

Construct a RestrictionAllowlist Builder

See `https://developer.android.com/reference/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html> originPatterns` | List of origin patterns to allow the selected behaviors on. |

## Public methods

### addJavaScriptInterface

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

```
public @NonNull RestrictionAllowlist.Builder addJavaScriptInterface(@NonNull Object object, @NonNull String name)
```

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)

```
public @NonNull RestrictionAllowlist build()
```

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

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