I'm trying to find a list of objects that are after a certain DateTime. In order to do so, I've created the following query:
return foos.retrieve(QueryFactory.equal(EXPIRY_INDEX, new DateTime()));
I then created the following index:
public static final Attribute<Foo, DateTime> EXPIRY_INDEX = new SimpleAttribute<Foo, DateTime>() {
@Override
public DateTime getValue(Foo foo, QueryOptions queryOptions) {
return foo.getEXPIRY();
}
};
So far all good, except, the equal(...) method will invoke DateTime.equals(...) as far as I know which will ultimately return false all the time. What I need is a way to call DateTime.isAfterNow(...) or DateTime.isAfter(...).
How can I find all elements in a collection that have a DateTime after right now?