declex
declex copied to clipboard
Actions for models
Every models should have an action to instantiate it and make complex operations over it:
Ex.
@UseModel
public class User {
String firstName;
String lastName;
String email;
}
Instantiante an user:
User user = $User().firstName("Bob")
.lastName("River")
.email("[email protected]")
.get();
Queries
The queries mechanism should be embedded in the action for the models, so:
User user = $User().query("firstName='Bob'").get();
List<User> user = $User().query("firstName='%B'").list();
This is very important to decouple the internal used ORM (ActiveAndroid, Realm or other) with the queries mechanism.