Is there already a solution to this, as I now have the very same problem (a Double value that must be null if the value is empty and not 0 - but if value is empty, an exception is thrown).
Btw, I just startet to use T5 and I'm realy blown away! It's amazing how simple most things can be done! Very, very cool! Thanks, Max Howard Lewis Ship wrote: > > We're definitely getting into some contention here, as others are just as > eloquent that nulls should be coerced to zeros (and that's a code change > that went in last week). > > I think this needs more consideration. I'm thinking this needs to be > decided using a translator and there should be an easy way to handle this > inside BeanEditor. For example, property type Integer (wrapper type) uses > null when the user input is blank, but type int (the primitive) uses 0. > > On 10/3/07, Tom Davies <[EMAIL PROTECTED]> wrote: >> >> I'd like to be able to have optional values in a BeanEditForm linked >> bean represented as null, e.g. if they are of type Integer. >> >> I get the exception below. >> >> Should 'null' just coerce straight to null, unless it is trying to go >> to a primitive type? >> >> In TypeCoercerImpl, perhaps: >> >> // Treat null as void in terms of locating a coercion. >> >> Class sourceType = input != null ? input.getClass() : >> void.class; >> >> Should be: (untested) >> >> if (input == null) >> { >> if (targetType.isPrimitive()) >> { >> throw ... >> } >> else >> { >> return null; >> } >> } >> >> Tom >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > Howard M. Lewis Ship > Partner and Senior Architect at Feature50 > > Creator Apache Tapestry and Apache HiveMind > > -- View this message in context: http://www.nabble.com/-T5--Null-fields-and-BeanEditForm--tf4561146.html#a13407610 Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]