Would be useful for indexed fields that change at fixed times, such as "date" objects. Consider the following code:
@HgValue(value="age", index= HgIndexStyle.ORDERED)
public int getAge() {
Date today = new Date();
Calendar cal = Calendar.getInstance();
cal.setTime(today);
int yearNow = cal.get(Calendar.YEAR);
cal.setTime(birthday);
int yearThen = cal.get(Calendar.YEAR);
return yearNow - yearThen;
}
It would be useful to have a quick way of updating the index when there is a new year automatically. Granted, this is a silly example, but if I think of a better one I'll comment here. You could think of a similar example where the result depends on the day and not the year.
Would be useful for indexed fields that change at fixed times, such as "date" objects. Consider the following code:
It would be useful to have a quick way of updating the index when there is a new year automatically. Granted, this is a silly example, but if I think of a better one I'll comment here. You could think of a similar example where the result depends on the day and not the year.