On Wed, 13 Aug 2003, David Graham wrote: > Date: Wed, 13 Aug 2003 20:01:59 -0700 (PDT) > From: David Graham <[EMAIL PROTECTED]> > Reply-To: Struts Developers List <[EMAIL PROTECTED]>, > [EMAIL PROTECTED] > To: Struts Developers List <[EMAIL PROTECTED]> > Subject: Re: Simplifying DynaActionForms > > --- Sgarlata Matt <[EMAIL PROTECTED]> wrote: > > >> Casting to String gets to be quite painful with many form properties. > > > > >> Unless I've forgotten/missed an easier way of dealing with > > >> DynaActionForms, I propose we add a > > DynaActionForm.getAsString(String) > > >> method that does this casting for us. > > > > This is a minor point, but how about DynaActionForm.getString(String) > > instead? > > I like your name better :-). > > > This would be consistent with naming conventions in > > java.sql.ResultSet (I can't think of other places with convenience > > methods like this off the top of my head). Also, following along in the > > > > java.sql.ResultSet thinking, would you also have getters for the other > > wrappers around primitives and the Date and Calendar objects? This > > might just clutter the interface... I wouldn't ever personally use them > > in my app because almost every form property is a String. > > Well, I thought we could start small with the String and take it from > there. My form properties are all Strings so that's why my suggestion was > aimed in that direction. >
If we go for this idea on DynaActionForm (I'm +0 on it at the moment), we should provide accessors for String and boolean properties, but I'd suggest we don't for any other types -- after all, Struts encourages you not to use things like Date or Calendar for a form bean property :-). Note that I'd be -1 on doing this sort of thing to the underlying DynaBean interface itself. Besides the fact that this would break current implementations (since DynaBean is an interface), I don't want to see a very simple API like DynaBean turn into a mass of methods like ResultSet. Also, if we were to add getString() and getBoolean(), we should also add setString() and setBoolean() for the same reasons. > David Craig --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]