cmelchior / realmfieldnameshelper

Realm extension library used to create more type-safe queries.
Apache License 2.0
173 stars 21 forks source link

Generate field names (strings) of related fields #40

Closed antoncyrol closed 4 years ago

antoncyrol commented 4 years ago

Say you have two Realm objects, Contact and Email as in this example. The support for nested member #4, makes queries like realm.where(Contact.class).equalTo("email.active", false).findAll() safe and nice as you can replace "email.active" with ContactFields.EMAIL.ACTIVE. However, for queries like realm.where(Contact.class).isNull("email").findAll() you still need to write down the string explicity since no field "email" is generated. It would be great if the string and the corresponding class object were generated, e.g. in this example ContactFields.EMAIL and ContactFields.EMAIL_FIELD or ContactFields.EMAIL_CLASS and ContactFields.EMAIL or similar.

antoncyrol commented 4 years ago

Sorry, I just found out that I can use ContactFields.EMAIL.$ for the isNull() query. Closing...