Definetely not. Hashcode is not required to be unique, different semantic. -Igor
> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Phil Kulak > Sent: Wednesday, August 10, 2005 5:13 PM > To: [email protected] > Subject: Re: [Wicket-user] DataView: IDataProvider.primaryKey() vote > > I think people are getting turned off by it being called > primaryKey() because that makes it sound like all you can > work from are databases. > It's really not though. It's more like hashCode(), but > returning a String. But if you called it something like > stringHashCode(), people wouldn't know what the hell you were > talking about. > > Actually, you know what, that gives me an idea: > > public abstract class SimpleDataProvider implements IDataProvider { > public String getPrimaryKey(Object o) { > return Integer.valueOf(o.hashCode()).toString(); > } > } > > Badda bing. ;) > > On 8/10/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > Right, we would need to have something like this: > > > > Public abstract class ModelIteratorDecorator { > > private Iterator delegate; > > > > ... > > > > public boolean hasNext() { > > return delegate.hasNext(); > > } > > > > public Object next() { > > return model(delegate.next()); > > } > > > > public abstract Imodel model(Object o); > > > > ... > > } > > > > And then in your dataprovider : > > > > public Iterator iterator(int first, int count) { > > Iterator it=getiteratorfromdatastore(); > > return new ModelIteratorDecorator(it) { > > public Imodel model(Object o) { > > ... > > } > > } > > > > This seems more complicated and more verbouse. > > > > -Igor > > > > > > > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > Jonathan Locke > > > Sent: Wednesday, August 10, 2005 3:18 PM > > > To: [email protected] > > > Subject: Re: [Wicket-user] DataView: > IDataProvider.primaryKey() vote > > > > > > > > > no, you just write an adaptor... > > > > > > Johan Compagner wrote: > > > > > > > > > > >> > > > >> i also don't quite understand the choice of the word > > > "Data" here... > > > >> isn't this really a TableView > > > >> or GridView more than a DataView? and if you keep the > details of > > > >> sorting and key/identity on the other side of the > > > interface, it would > > > >> work with things other than database objects... > > > > > > > > It is supposed to be an easy DataView for database objects Else > > > > you would just get a ListView... > > > > > > > >> > > > >> btw, why does model() exist? couldn't iterator just > > > produce a bunch > > > >> of IModels? this seems nice to me... > > > > > > > > If you don't do that then you have to loop twice over > everything... > > > > first in the iterator (that just returns directly a > > > hibernate list (or > > > > whatever db impl you have) > > > > > > > > return getContactsDB().find(first, count, "firstName", > > > > true).iterator(); > > > > > > > > Then that method would be completely different. > > > > First iterate yourself build up yet another List wrap > > > everything you > > > > get inside a IModel and then call iterate again on it. > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > > SF.Net email is Sponsored by the Better Software > Conference & EXPO > > > > September 19-22, 2005 * San Francisco, CA * Development > Lifecycle > > > > Practices Agile & Plan-Driven Development * Managing > > > Projects & Teams > > > > * Testing & QA Security * Process Improvement & Measurement * > > > > http://www.sqe.com/bsce5sf > > > > _______________________________________________ > > > > Wicket-user mailing list > > > > [email protected] > > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > ------------------------------------------------------- > > > SF.Net email is Sponsored by the Better Software > Conference & EXPO > > > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > > Practices Agile & Plan-Driven Development * Managing Projects & > > > Teams * Testing & QA Security * Process Improvement & > Measurement * > > > http://www.sqe.com/bsce5sf > > > _______________________________________________ > > > Wicket-user mailing list > > > [email protected] > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > SF.Net email is Sponsored by the Better Software Conference & EXPO > > September 19-22, 2005 * San Francisco, CA * Development Lifecycle > > Practices Agile & Plan-Driven Development * Managing > Projects & Teams > > * Testing & QA Security * Process Improvement & Measurement * > > http://www.sqe.com/bsce5sf > > _______________________________________________ > > Wicket-user mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & > EXPO September 19-22, 2005 * San Francisco, CA * Development > Lifecycle Practices Agile & Plan-Driven Development * > Managing Projects & Teams * Testing & QA Security * Process > Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Wicket-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
