简体   繁体   中英

Android greenDAO - Primitive data types

I'd like to ask if there is a way to use primitive data types as table fields with greenDAO? If it is, code example would be appreciated.

Thanks

As far as I know, you can't, at least with the provided framework. In the documentation, there's the PropertyType enum, which only have objects. Maybe you could, modifying the generated code, but I'm not quite sure and it seems a lot of manual work to do.

Seeing that the accepted answer points to a dead link, here's an update for GreenDao 3:

To add support for a custom type, you can map them to one of the supported types using a @Convert annotation. You also need to provide a PropertyConverter implementation.

More detailed info and an example can be found here:

http://greenrobot.org/greendao/documentation/custom-types/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM