It's more of a Java question. I have two types of user in my firebase. Both of the have almost the same fields (I use the call the methods of the same fields only in the adapter) I'm trying to create a FirestoreRecyclerAdapter. I want to make it generic so I will not have code duplication.
The code:
FirestoreRecyclerOptions<TypeUser1> options = new FirestoreRecyclerOptions.Builder<TypeUser1>().setQuery(query, TypeUser1.class).build();
adapter = new UsersAdapter(options);
In UsersAdapter I have:
public class UsersAdapter extends FirestoreRecyclerAdapter<TypeUser1, UsersAdapter.UserHolder> {
I want some how to remove TypeUser1and use some generic value so I will have one class UsersAdapter. Something like:
FirestoreRecyclerOptions<USER> options = new FirestoreRecyclerOptions.Builder<USER>().setQuery(query, USER.class).build();
adapter = new UsersAdapter(options);
I'm familiar with the concept of Generics in Java but will it work with Firebase?