# TypeConverters

Artifact: [androidx.room:room-common](https://developer.android.com/jetpack/androidx/releases/room) [View Source](https://cs.android.com/search?q=file:androidx/room/TypeConverters.kt+class:androidx.room.TypeConverters) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/room#2.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  @Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD, AnnotationTarget.CLASS])
  @Retention(value = AnnotationRetention.BINARY)
  annotation TypeConverters
  ```

*** ** * ** ***

Specifies additional type converters that Room can use. The TypeConverter is added to the scope of the element so if you put it on a class / interface, all methods / fields in that class will be able to use the converters.

TypeConverters can only be used to convert columns / fields, hence cannot be used by a method with a row return value such as DAO methods that query rows.

- If you put it on a `https://developer.android.com/reference/kotlin/androidx/room/Database`, all Daos and Entities in that database will be able to use it.

- If you put it on a `https://developer.android.com/reference/kotlin/androidx/room/Dao`, all methods in the Dao will be able to use it.

- If you put it on an `https://developer.android.com/reference/kotlin/androidx/room/Entity`, all fields of the Entity will be able to use it.

- If you put it on a POJO, all fields of the POJO will be able to use it.

- If you put it on an `https://developer.android.com/reference/kotlin/androidx/room/Entity` field, only that field will be able to use it.

- If you put it on a `https://developer.android.com/reference/kotlin/androidx/room/Dao` method, all parameters of the method will be able to use it.

- If you put it on a `https://developer.android.com/reference/kotlin/androidx/room/Dao` method parameter, just that field will be able to use it.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room/TypeConverter` |   |

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room/TypeConverters#TypeConverters(kotlin.Array,androidx.room.BuiltInTypeConverters)( vararg value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<*>, builtInTypeConverters: https://developer.android.com/reference/kotlin/androidx/room/BuiltInTypeConverters )` | Cmn |

| ### Public properties |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room/BuiltInTypeConverters` | `https://developer.android.com/reference/kotlin/androidx/room/TypeConverters#builtInTypeConverters()` Configure whether Room can use various built in converters for common types. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<*>>` | `https://developer.android.com/reference/kotlin/androidx/room/TypeConverters#value()` The list of type converter classes. | Cmn |

## Public constructors

### TypeConverters

Cmn Added in [2.8.5](https://developer.android.com/jetpack/androidx/releases/room#2.8.5)

```
TypeConverters(
    vararg value: KClass<*> = [],
    builtInTypeConverters: BuiltInTypeConverters = BuiltInTypeConverters()
)
```

## Public properties

### builtInTypeConverters

Cmn

```
val builtInTypeConverters: BuiltInTypeConverters
```

Configure whether Room can use various built in converters for common types. See `https://developer.android.com/reference/kotlin/androidx/room/BuiltInTypeConverters` for details.

### value

Cmn

```
val value: Array<KClass<*>>
```

The list of type converter classes. If converter methods are not static, Room will create an instance of these classes.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<*>>` | The list of classes that contains the converter methods. |