# CursorMapper

Artifact: [androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/database/CursorMapper.java+class:androidx.leanback.database.CursorMapper) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***


```
public abstract class CursorMapper
```

<br />

*** ** * ** ***

Abstract class used to convert the current `https://developer.android.com/reference/android/database/Cursor.html` row to a single object.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/leanback/database/CursorMapper#CursorMapper()()` |

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/leanback/database/CursorMapper#convert(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html cursor)` Convert a `https://developer.android.com/reference/android/database/Cursor.html` at its current position to an Object. |

| ### Protected methods |
|---|---|
| `abstract https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/leanback/database/CursorMapper#bind(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html cursor)` A subclass should implement this method to create a single object using binding information. |
| `abstract void` | `https://developer.android.com/reference/androidx/leanback/database/CursorMapper#bindColumns(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html cursor)` Called once when the associated `https://developer.android.com/reference/android/database/Cursor.html` is changed. |

## Public constructors

### CursorMapper

Added in 1.1.0

```
public CursorMapper()
```

## Public methods

### convert

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

```
public Object convert(Cursor cursor)
```

Convert a `https://developer.android.com/reference/android/database/Cursor.html` at its current position to an Object.

## Protected methods

### bind

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

```
protected abstract Object bind(Cursor cursor)
```

A subclass should implement this method to create a single object using binding information. This method is not intended to be called outside of CursorMapper.

### bindColumns

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

```
protected abstract void bindColumns(Cursor cursor)
```

Called once when the associated `https://developer.android.com/reference/android/database/Cursor.html` is changed. A subclass should bind column indexes to column names in this method. This method is not intended to be called outside of CursorMapper.