objectbox / objectbox/objectbox-java
Allow specifying custom type converters per table or globally too
@greenrobot-team já está trabalhando nisso.
Desde 24/8/2020.
- Linguagem predominante
- Java
- Estrelas
- 4.6k
- Forks
- 311
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Avaliação
Esta issue ainda não foi avaliada.