commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: [DynaBean] a couple of other existing projects...
Date Thu, 03 Jan 2002 13:36:50 GMT
From: "Ted Husted" <husted@apache.org>
> Paulo Gaspar wrote:
> > For such use it makes sense to have a specialized DynaClass and some
> > helpers,
>
> Agreed. I'm just thinking that the first thing I will do with a DynaBean
> is define a number of standard field or column helpers, that would
> correlate to the columns or fields in a database.
>
> Since this will be a common idea, we might want to consider a companion
> package to the DynaBean that defined these helpers. This could save us,
> and dozens of others, from each implementing our own, all with the same
> goals.

Agreed. Maybe a DynaClass could be constructed from a list/array of
DynaProperty objects, then we could have a library of derived DynaProperty
classes for standard properties, default values, range contraints etc.

e.g.

String[] sexes = [ "m", "f" ];
DynaProperty[] properties = {
    new StringProperty( "name" ),
    new PercentProperty( "score" ),
    new DateProperty( "birthday" ),
    new ChoiceProperty( "sex", sexes )
    new DynaProperty( "foo", Foo.class )
};
DynaClass personClass = new DynaClass( "Person", properties );
DynaBean person = personClass.newInstance();

> There are are finite number of column types supported by the JDBC, so
> I'm thinking there could be a toolkit for generating these and rolling
> them into a DynaBean.
>
> Since any value can be represented as a String, such a helper might
> include a String buffer along with its native object, and could be very
> useful in ferrying input from the Web tier (which is String based) to
> the Business tier (which often needs native values). So each column
> helper would have a getXXX form and a getXXXString form. There may also
> be a setXXXBuffer form to enter data for later validation, and then a
> trigger for the valiation/conversion routine.

I'm thinking we should maybe have a seperate converters to/from JDBC,
to/from XML (e.g. XML Schema Data Types) and to/from Strings (web tier or
Swing controls).

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message