lundi 18 mai 2015

Using Reflection with Realm (Android)

I made a switch to Realm last week. Now, I've got this issue when using reflection:

Normally I'd use reflection to fetch field, which when available I'd use to replace url params in our API url f/e: blog/{blogId}/comments <- not an actual url but an example.

The code would check if there is a field called blogId, if yes it'll invoke the getter (getBlogId) and replace the value in the path. Now with realm I get a "BlogRealmProxy" which does not contain the properties I was expecting on my RealmObject, it has fields like INDEX_BLOGID (or alike).

Any idea how to use reflection still? I need this to have generic functions available.





Aucun commentaire:

Enregistrer un commentaire