Skip to content

Database read objects list

Mk5 edited this page Jul 6, 2019 · 3 revisions
class ReadObjectsListExample {

    @Override
    void action() {
        GdxFIRDatabase.promise()
                .then(GdxFIRDatabase.inst().inReference("/employees").readValue(List.class))
                .after(GdxFIRAuth.inst().signInAnonymously())
                .then(new Consumer<List<Employee>>() {
                    @Override
                    @MapConversion(Employee.class)
                    public void accept(List<Employee> list) {
                        success();
                    }
                });
    }

    @Override
    void action2() {
        GdxFIRDatabase.inReference("/employees")
                .readValue(List.class)
                .after(GdxFIRAuth.inst().signInAnonymously())
                .then(new Consumer<List<Employee>>() {
                    @Override
                    @MapConversion(Employee.class)
                    public void accept(List<Employee> list) {
                        success();
                    }
                });
    }

}
Clone this wiki locally