Henri Yandell wrote:
I could be utterly wrong here, but I've always thought the Convert stuff
was String->Object, even though the API is convert(Class, Object);Object.
I think the second parameter is effectively a String for uses within
beanutils.
This (String-to-Object) was definitely the initial reason for the
existence of ConvertUtils (it started in Struts, where this code was
originally used to populate form bean properties from request parameters
(which are always strings).
For Object->String, you would basically want to be looking at a Formatter
library [java.text.Format, with DateFormat being obvious choices].
You can actually do this with ConvertUtils by registering a Converter
for java.lang.String that looks at the Class argument to decide what
object type the output should be. Of course, for date/time values, you
have to figure out how you're going to deal with all the formatting and
locale-specific options, so using DateFormat and friends is probably the
better path.
Dunno though, could be a lot going on I haven't looked at much in
BeanUtils. Still trying to understand the whole Locale section.
Hen
Craig
On Fri, 26 Sep 2003, Sgarlata Matt wrote:
I'm sure this is a simple question, but I am quite confused. I am trying to
do two things using ConvertUtils
1) Convert a String of the form "19 September 2003" to a Date
2) Convert a Date to a String of the form "19 September 2003"
#1 (String -> Date) I can do no problem with my own custom Converter class.
Does anyone know how to do #2 (Date -> String) automatically with
ConvertUtils?
Thanks!
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]