Roomデータベースエンティティのコンテキスト内で2つのものを入れ替えることができますか、そうでない場合は、それらの違いは何ですか?Android Room:@Ignore vs Transient
-2
A
答えて
2
@Ignore
はRoom固有の注釈であり、Roomはそのフィールドまたはメソッドを無視する必要があると言っています。
transient
は、Javaの構成であり、this field should not be serialized in standard Java serializationを示します。 Room happens to treat this similarly to @Ignore
by default。ほとんどの場合、あなたがtransient
を使用するクラスから継承し、そのクラスを制御していない場合(つまり、ライブラリからのものなど)です。
Javaシリアル化を使用していない場合は、フィールドに@Ignore
を貼ることをお勧めします。 transient
はメソッドに使用できるキーワードではないため、Roomに特定のコンストラクタを無視するように指示するには、@Ignore
を使用するしかありません。
関連する問題
- 1. @Transient vs decorator
- 2. Polly Framework VS Microsoft Transient Fault Handling
- 3. Git Submodule vs ignore files
- 4. Android Room + AsyncTask
- 5. Android room migration nullエラー
- 6. Android Room AutoValueの永続ライブラリエンティティ
- 7. Android room typeconverterの問題
- 8. Kotlinと@Transient
- 9. JSON:@Transientフィールド
- 10. Kotlin、JPAと@Transient
- 11. Hibernate override @transient
- 12. Java MouseListener transient
- 13. Hibernate @Transient MappingException
- 14. hg diff ignore^M
- 15. Room Dao条件
- 16. フラッドフィルアルゴリズム - Room Area
- 17. ROOM OutOfMemoryErrorR(OOM)
- 18. Socket.io MVC node.js room
- 19. AndroidアプリのRealm VSルーム
- 20. PHPクラスの "Transient"プロパティ?
- 21. Android AsyncTask vsスレッド+ハンドラvs rxjava
- 22. Preproccessor ignore
- 23. Woocommerce - Wordpress Hotel/Roomカスタムポスト
- 24. io.sockets.in( "room")。emit( "message"、 "hello");
- 25. Quit and Re-join room
- 26. for(Room r:ArrayList <Room>)は空を返します。
- 27. Android Room永続ライブラリがライブラリプロジェクト内で動作しない
- 28. @UpdateはどのようにAndroid Roomで動作しますか?
- 29. Android:タイプコンバータの作り方(for Room)全般のコトルのオブジェクトリスト
- 30. AndroidアーキテクチャのコンポーネントliveDataとroom - 最小要件は何ですか?
ルーム内のトランジェントへの参照が見つかりません。 https://developer.android.com/training/data-storage/room/defining-data.html – joao86
トランジエントは統合キーワードですが、@ ignoreはルーム – Zoe
@ joao86 https://docs.oracle.com/javaseによって追加されています。 /specs/jls/se7/html/jls-8.html#jls-8.3.1.3 https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-transient/index.html – Pavlus