// create/open a database
Nitrite db = Nitrite.builder()
.openOrCreate("user", "password");
// create an object repository
ObjectRepository<Employee> employeeStore = db.getRepository(Employee.class);
// observe any change to the repository
employeeStore.register(new ChangeListener() {
@Override
public void onChange(ChangeInfo changeInfo) {
// your logic based on action
}
});
// insert an object
Employee emp = new Employee();
emp.setName("John Doe");
employeeStore.insert(emp);