# CaptureRequestWrappers

Artifact: [androidx.camera:camera-common](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/common/CaptureRequestWrapper.kt+class:androidx.camera.common.CaptureRequestWrappers) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
public static class CaptureRequestWrappers
```

<br />

*** ** * ** ***

Helper utilities for constructing and wrapping `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper` instances.

## Summary

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrappers` | `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrappers#INSTANCE()` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper` | `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrappers#wrap(android.hardware.camera2.CaptureRequest,kotlin.collections.Map)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html captureRequest, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull ?>, https://developer.android.com/reference/java/lang/Object.html> metadata )` Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` and optional custom metadata into a `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper`. |

## Public fields

### INSTANCE

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public static @NonNull CaptureRequestWrappers INSTANCE
```

## Public methods

### wrap

```
public static final @NonNull CaptureRequestWrapper wrap(
    @NonNull CaptureRequest captureRequest,
    @NonNull Map<@NonNull Metadata.Key<@NonNull ?>, Object> metadata
)
```

Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` and optional custom metadata into a `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper`.

```kotlin
import androidx.camera.common.CaptureRequestWrapper
import androidx.camera.common.CaptureRequestWrappers
import androidx.camera.common.Metadata

// Wrap a native CaptureRequest into a CaptureRequestWrapper.
val requestWrapper: CaptureRequestWrapper = CaptureRequestWrappers.wrap(captureRequest)

// Query native Camera2 CaptureRequest keys:
val aeMode = requestWrapper[CaptureRequest.CONTROL_AE_MODE]

// Or attach custom library/application metadata to the request:
val customKey = Metadata.Key<String>("com.example.custom_request_tag")
val requestWithMetadata =
    CaptureRequestWrappers.wrap(
        captureRequest,
        metadata = mapOf(customKey to "sample_tag_value"),
    )
val customTagValue = requestWithMetadata[customKey]
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html captureRequest` | the native `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.html` to wrap. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull ?>, https://developer.android.com/reference/java/lang/Object.html> metadata` | optional map of custom `https://developer.android.com/reference/androidx/camera/common/Metadata.Key` values to attach to the wrapper. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper` | a `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper` wrapping the given `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrappers#wrap(android.hardware.camera2.CaptureRequest,kotlin.collections.Map)` and `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrappers#wrap(android.hardware.camera2.CaptureRequest,kotlin.collections.Map)`. |