Reputation: 6177
Is it possible to create "realmquery" in android dynamically and pass it to realm database?
something like this
RealmQuery<RealmModel> query;
public Model equalTo(String fildName,String value){
query=query.equalTo(fildName,value);
return (Model) this;
}
Upvotes: 0
Views: 304
Reputation: 10971
I believe you can do yourself it by wrapping your queries in utility classes, define your table names and columns as string constants and constructing your queries with the builder pattern, I suggest something like this:
RealmUtils.query(Model.class).where(Model.FIELD1).equals("param1")
.And(MODEL.FIELD2).greaterThan(param2);
This way you can encapsulate Realm string queries and deal with strong types.
Upvotes: 1