i guess i don't precisely understand what you're doing. if you don't
want to introduce
a new model type, which seems fine to me... maybe you can still keep
your component
neutral and general by keeping your method for determining identity on
the other side of
the interface. what about:
public interface IDataProvider extends Serializable
{
Iterator iterator(int first, int count);
int size();
IModel model(Object object);
boolean isSame(Object a, Object b)
}
?
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...
btw, why does model() exist? couldn't iterator just produce a bunch of
IModels? this seems
nice to me...
public interface TableView.IRange
{
Iterator<IModel> iterator(int first, int count);
int size();
boolean isSame(IModel a, IModel b)
}
how the thing produces IModels and how it determines equality are up to
the user.
this component could be used to replace listview functionality as well
as working
with databases... no?
Igor Vaynberg wrote:
In this case primaryKey() can be a db primary key or a business primary key
since there is a 1-1 mapping.
Also, I don't think it would make sense to have dataview depending on an
external IDatabaseModel.
-Igor
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Jonathan Locke
Sent: Wednesday, August 10, 2005 1:13 PM
To: [email protected]
Subject: Re: [Wicket-user] DataView: IDataProvider.primaryKey() vote
i realize i'm jumping into the middle of a conversation i
haven't been following, but i saw the code below and thought of this:
public interface IDatabaseModel extends IModel {
public boolean isSame(IDatabaseModel model); }
that seems like a nice general way to define sameness between
database models without knowing how it's implemented.
then maybe create an abstract base class for typical database
models that define equality in terms of primary keys and/or
one that does it in terms of Object.equals().
my very limited understanding of hibernate is that you want to define
Object.equals() in hibernate based on business fields rather
than primary key.
but in any case, with the contract above, you could push the
notion of how something is "the same" out of the contract and
into the implementation, where it probably belongs...
i don't know. i may not understand what you're doing. hope
i'm not starting a flame war...
jon
Phil Kulak wrote:
-1
If we wanted to get that method out of the DataProvider interface, I
think it would be better to move it into the model:
public interface IDataModel extends IModel {
public String getPrimaryKey();
}
I just woudn't like relying on an implementation of equals()
that may
or may not exst, and the code because less seft documenting.
-------------------------------------------------------
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