On Wed, Feb 6, 2013 at 8:20 AM, Dan Haywood <d...@haywood-associates.co.uk>wrote:
> On 6 February 2013 02:16, Kevin Meyer <ke...@kmz.co.za> wrote: > > > Hi Dan, > > > > > > > > > So, sure, I guess I can look into enhancing QueryAbstract with optional > > parameters. > > > +1 > +1 too > > How about a new withPaging(start, count) method, eg: > > public class QueryAbstract { > > ... > public QueryAbstract withPaging(int start, int count) { > this.start = start; > this.count = count; > return this; > } > > } > Paging is IMHO a concept that lives in the viewer. When it comes to querying data I opt to adapt the JDO concept "Range" [1] i.e. setRange(int start, int end) or withRange(int start, int end) [1] http://db.apache.org/jdo/api20/apidocs/javax/jdo/Query.html#setRange(long, long) > > > > > > Does anyone have anything to add regarding method signature? Start and > > count vs start and end, for example? I think start and cound is more > > obvious (and couples with the paging annotation). > > > > I'm happy with those names (rather than start/end) > > > > > > As for your other question: I used "find by pattern" quite nicely in my > > deployed app, so I'd like to see it preserved. Find by title is a simple > > specific implementation of pattern, but could be useful... dunno. > > > > OK, thx. The thing about search by title is that - to be efficient - it > requires that the objectstore has persisted the title in a column > somewhere. I'd rather that the programmer decides to do this explicitly > (eg by having a hidden property that holds the title and search on that) > than have the framework do some magic. > > ie, if the programmer really wants to support search by title, they can > just do: > > public class ToDoItem { > > > @Title > @Hidden > public String getTitle() { ... } > public void setTitle(String t) { ... } > > private void recomputeTitle() { // call whenever a component part of > title has changed > setTitle(....); > } > > } > > Dan > > Regards, > > Kevin > > > > >