Here we go again,
=:o)
> -----Original Message-----
> From: Ted Husted [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 03, 2002 7:20 PM
> To: Jakarta Commons Developers List
> Subject: Re: [DynaBean] a couple of other existing projects...
>
>
> Paulo Gaspar wrote:
>
> ...
>
> The objects in this package may also have their own converters, but that
> would not affect the design of the base DynaBeans.
Cool! This way my little obsession is not being attacked yet.
=;o)
> Paulo Gaspar wrote:
> > For many things I never go trough the String step. Some things I do when
> > converting:
> > - I always convert any Number descendent to another Number type using
> > the methods in the Number interface (yes, I validate overflows);
> > - I convert JDBC date/time types into java.util.Date... and I already
> > miss converting also to other types;
> > - I do not duplicate immutable objects if the source column type is the
> > same as the destination type.
> >
> > I will try to post my Converter here in a couple of days. It is really
> > simple.
>
> Where the getXxxBuffer comes into play is with data validation and
> CORRECTION. The idea is that you need to buffer whatever they input, so
> you can return it to them for correction (without relying on the browser
> back button).
Aaaaaaaaahhhhhhh!!!!!
Understood!
But you can use something like a simple Map as a buffer and a "normal"
(whatever that means) DynaBean for the rest. The buffer does not need type
information and other DynaBean stuff, it just needs to be a map of names
to values.
(This means I still did not "get it" all.)
> The getXxxString accessor may be just a standard converter for the type,
> or may return a formatted version. For example a telphone number may be
> stored as all digits in the database, but punctuated on the page. So if
> I want the raw version, I can ask for getXxx when I want the formatted
> version, I ask for getXxxString. In some case, they may both return
> Strings, but one might be formatted.
What is the "Xxx" here?
(The property name is an argument on DynaBean accessors, so I am excluding
that one.)
> James Strachan wrote:
> > 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();
>
> That's the general idea, though these do not have to be Dyna anythings.
> I'm thinking of a conventional base object to represent a column, with
> subclasses to represent the different types. The object would have
> properties representing the column name, label, type, range, validation,
> converter, state, and so forth.
>
> In a real application, we are already creating all this someplace, it's
> just getting spread around.
>
> This package does not even need to be DynaBean-aware, and I'm sure
> people have done similar things in the past. But, if we insert something
> like this into the DynaBean at initialization, they get exposed as
> ordinary JavaBean properties, rather than as some custom class.
I am inclined to use DynaBeans a lot for this kind of thing although with
a more Access-like meatadata/functionality (now I understand what you
meant).
I am starting with something like that. It is my 2nd attempt on the web
and my n-th overall. It did not help that I was trying too many new things
in the previous attempt.
(In many respects the Web is too different from (lets say) a 2 tier
Windows application... although probably similar to a 3+ tier one. I am
very interested on this stuff.)
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Building Java web applications with Struts.
> -- Tel +1 585 737-3463.
> -- Web http://www.husted.com/struts/
Have fun,
Paulo Gaspar
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>