I need use this method with three distinct classes: Orders, Customers, Suppliers
public void saveObjectKey(String filename, Long start) {
Query<Orders> query = datastore.createQuery(Orders.class)
.field("O_ORDERKEY").greaterThan(start);
for (Orders orders : query.fetch()) {
Util.writeFile(orders.getPrimaryKey().toString(), filename);
}
}
I had thought in an ugly solution, a if else if solution:
if(instanceof Orders).... else if(instanceof Customers)..... else if(instanceof Suppliers)....
Now i need a generic solution, how can i do it?