objectbox / objectbox/objectbox-java

Allow specifying custom type converters per table or globally too

オープン
#899 コメント 1 件 リアクション 5 件 担当者 1 名 GitHub で見る

@greenrobot-team がすでに取り組んでいます。

2020年8月24日 から。

enhancement
主要言語
Java
スター
4.6k
フォーク
311
PR マージ指標
30日以内にマージされた PR はありません

説明

Currently, to convert a custom type, we have to annotate each field of that type individually with @Convert.
This is very inconvenientt, because if you have a custom type, e.g. joda.time.DateTime you'll always want to convert it, so it would be much cleaner and less error-prone if we could define custom type converters per table or for the whole database too, like Room does it with TypeConverters.

Describe the solution you'd like
For a per-entity definition of converters, one could extend the @Entity annotation something like this:

@Entity(converters={@Convert(...), @Convert(...),...}
public class User ...

For defining converters globally, the ObjectBox builder could be extended.

Describe alternatives you've considered
Currently, the only alternative is to add @Convert to each and every field.

Additional context
As said above, you can have a look at Room's @TypeConverter annotation that can be applied to METHOD, PARAMETER, TYPE and FIELD.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。