Stay organized with collections
Save and categorize content based on your preferences.
TypeConverters
public
abstract
@interface
TypeConverters
implements
Annotation
android.arch.persistence.room.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.
- If you put it on a
Database
, all Daos and Entities in that database will be able to
use it.
- If you put it on a
Dao
, all methods in the Dao will be able to use it.
- If you put it on an
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
Entity
field, only that field will be able to use it.
- If you put it on a
Dao
method, all parameters of the method will be able to use it.
- If you put it on a
Dao
method parameter, just that field will be able to use it.
Summary
Public methods |
Class[]<?>
|
value()
The list of type converter classes.
|
Inherited methods |
From interface
java.lang.annotation.Annotation
abstract
Class<? extends Annotation>
|
annotationType()
|
abstract
boolean
|
equals(Object arg0)
|
abstract
int
|
hashCode()
|
abstract
String
|
toString()
|
|
Public methods
value
Class[]<?> value ()
The list of type converter classes. If converter methods are not static, Room will create
an instance of these classes.
Returns |
Class[]<?> |
The list of classes that contains the converter methods.
|
Annotations
Classes
Enums
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# TypeConverters\n\nSummary: [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nTypeConverters\n==============\n\n| The `android.arch` Architecture Components packages are no longer maintained. They have been superseded by the corresponding [androidx.\\*](/jetpack/androidx/migrate) packages. See [androidx.room.TypeConverters](/reference/androidx/room/TypeConverters) instead.\n\n\n`\npublic\n\n\nabstract\n@interface\nTypeConverters\n`\n\n\n`\n\n\nimplements\n\nAnnotation\n\n\n`\n\n|----------------------------------------------|\n| android.arch.persistence.room.TypeConverters |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nSpecifies additional type converters that Room can use. The TypeConverter is added to the scope\nof the element so if you put it on a class / interface, all methods / fields in that class will\nbe able to use the converters.\n\n- If you put it on a [Database](/reference/android/arch/persistence/room/Database), all Daos and Entities in that database will be able to use it.\n- If you put it on a [Dao](/reference/android/arch/persistence/room/Dao), all methods in the Dao will be able to use it.\n- If you put it on an [Entity](/reference/android/arch/persistence/room/Entity), all fields of the Entity will be able to use it.\n- If you put it on a POJO, all fields of the POJO will be able to use it.\n- If you put it on an [Entity](/reference/android/arch/persistence/room/Entity) field, only that field will be able to use it.\n- If you put it on a [Dao](/reference/android/arch/persistence/room/Dao) method, all parameters of the method will be able to use it.\n- If you put it on a [Dao](/reference/android/arch/persistence/room/Dao) method parameter, just that field will be able to use it.\n\n\u003cbr /\u003e\n\n**See also:**\n\n- [TypeConverter](/reference/android/arch/persistence/room/TypeConverter)\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------|----------------------------------------------------------------------------------------------------------------------|\n| ` Class[]\u003c?\u003e` | ` `[value](/reference/android/arch/persistence/room/TypeConverters#value())`() ` The list of type converter classes. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From interface ` java.lang.annotation.Annotation ` |-----------------------------------------|-------------------------| | ` abstract Class\u003c? extends Annotation\u003e` | ` annotationType() ` | | ` abstract boolean` | ` equals(Object arg0) ` | | ` abstract int` | ` hashCode() ` | | ` abstract String` | ` toString() ` | ||\n\nPublic methods\n--------------\n\n### value\n\n```\nClass[]\u003c?\u003e value ()\n```\n\nThe list of type converter classes. If converter methods are not static, Room will create\nan instance of these classes.\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------------|-----------------------------------------------------------------|\n| `Class[]\u003c?\u003e` | The list of classes that contains the converter methods. \u003cbr /\u003e |\n\n-\n\n Annotations\n -----------\n\n - [ColumnInfo](/reference/android/arch/persistence/room/ColumnInfo)\n - [ColumnInfo.Collate](/reference/android/arch/persistence/room/ColumnInfo.Collate)\n - [ColumnInfo.SQLiteTypeAffinity](/reference/android/arch/persistence/room/ColumnInfo.SQLiteTypeAffinity)\n - [Dao](/reference/android/arch/persistence/room/Dao)\n - [Database](/reference/android/arch/persistence/room/Database)\n - [Delete](/reference/android/arch/persistence/room/Delete)\n - [Embedded](/reference/android/arch/persistence/room/Embedded)\n - [Entity](/reference/android/arch/persistence/room/Entity)\n - [ForeignKey](/reference/android/arch/persistence/room/ForeignKey)\n - [ForeignKey.Action](/reference/android/arch/persistence/room/ForeignKey.Action)\n - [Ignore](/reference/android/arch/persistence/room/Ignore)\n - [Index](/reference/android/arch/persistence/room)\n - [Insert](/reference/android/arch/persistence/room/Insert)\n - [OnConflictStrategy](/reference/android/arch/persistence/room/OnConflictStrategy)\n - [PrimaryKey](/reference/android/arch/persistence/room/PrimaryKey)\n - [Query](/reference/android/arch/persistence/room/Query)\n - [RawQuery](/reference/android/arch/persistence/room/RawQuery)\n - [Relation](/reference/android/arch/persistence/room/Relation)\n - [SkipQueryVerification](/reference/android/arch/persistence/room/SkipQueryVerification)\n - [Transaction](/reference/android/arch/persistence/room/Transaction)\n - [TypeConverter](/reference/android/arch/persistence/room/TypeConverter)\n - [TypeConverters](/reference/android/arch/persistence/room/TypeConverters)\n - [Update](/reference/android/arch/persistence/room/Update)\n-\n\n Classes\n -------\n\n - [DatabaseConfiguration](/reference/android/arch/persistence/room/DatabaseConfiguration)\n - [InvalidationTracker](/reference/android/arch/persistence/room/InvalidationTracker)\n - [InvalidationTracker.Observer](/reference/android/arch/persistence/room/InvalidationTracker.Observer)\n - [Room](/reference/android/arch/persistence/room/Room)\n - [RoomDatabase](/reference/android/arch/persistence/room/RoomDatabase)\n - [RoomDatabase.Builder](/reference/android/arch/persistence/room/RoomDatabase.Builder)\n - [RoomDatabase.Callback](/reference/android/arch/persistence/room/RoomDatabase.Callback)\n - [RoomDatabase.MigrationContainer](/reference/android/arch/persistence/room/RoomDatabase.MigrationContainer)\n - [RoomWarnings](/reference/android/arch/persistence/room/RoomWarnings)\n - [RxRoom](/reference/android/arch/persistence/room/RxRoom)\n-\n\n Enums\n -----\n\n - [RoomDatabase.JournalMode](/reference/android/arch/persistence/room/RoomDatabase.JournalMode)\n-\n\n Exceptions\n ----------\n\n - [EmptyResultSetException](/reference/android/arch/persistence/room/EmptyResultSetException)"]]