Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 3116 invoked from network); 1 Mar 2005 20:44:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Mar 2005 20:44:46 -0000 Received: (qmail 84559 invoked by uid 500); 1 Mar 2005 20:44:45 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 84039 invoked by uid 500); 1 Mar 2005 20:44:43 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 84008 invoked by uid 99); 1 Mar 2005 20:44:43 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of craigmcc@gmail.com designates 64.233.170.200 as permitted sender) Received: from rproxy.gmail.com (HELO rproxy.gmail.com) (64.233.170.200) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 01 Mar 2005 12:44:41 -0800 Received: by rproxy.gmail.com with SMTP id j1so1335458rnf for ; Tue, 01 Mar 2005 12:44:39 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=Mraqnyd61fUNGcknAFDEmRXGPHpKMVXeesF/cwbkdiaYgxK70EuJfBPdtbJx8KHv1yJSoTxTL5MJXiop6qrUAppKojGQZSIrU8c2cmxpHiDFXSAJvlHEiY5RC4c2aoWjqzXfnWKYPrQXHxShQ5mdSFsfhXmh+jLkiV8GH22fJrg= Received: by 10.38.97.77 with SMTP id u77mr64333rnb; Tue, 01 Mar 2005 12:44:08 -0800 (PST) Received: by 10.39.3.22 with HTTP; Tue, 1 Mar 2005 12:44:07 -0800 (PST) Message-ID: Date: Tue, 1 Mar 2005 12:44:07 -0800 From: Craig McClanahan Reply-To: craigmcc@apache.org To: Jakarta Commons Developers List Subject: Re: [Commons Digester 1.6] Custom properties class converters In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N There is no default converter for java.util.Date precisely because the desired conversion is going to be both Locale and desired-format dependent, so registering your own is the right general approach. For the YYYY-MM-DD date format in particular, that happens to be the default String format for a java.sql.Date, for which there is a default converter registered. Craig On Tue, 1 Mar 2005 15:27:59 -0500, Slonim, Greg (Contractor) wrote: > When Digester is populating properties on the bean it uses > org.apache.commons.beanutils.BeanUtils.populate(Object, Map) to populate > object's values. BeanUtilsBean uses various implementations of > org.apache.commons.beanutils.Converter to convert the values from > Strings to particular types of objects. Sometimes the default converters > do not work as intended. Example: I have java.util.Date fields in my > bean among other things. XML data is coming in in format yyyy-MM-dd and > it breaks the conversion. I have to manually register > DataLocaleConverter for this to work. Is there an elegant way to solve > this problem without explicitly doing > > ConvertUtils.register(new DateLocaleConverter(null, Locale.US, > "yyyy-MM-dd"), Date.class); > > in my code? > > Regards, > > Greg Slonim > Senior Software Consultant > Finance and Portfolio Technologies > Fannie Mae, Washington DC > 202-752-3820 > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-dev-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org