[webbeans-dev] Question about parsing Date fields in XML based metadata

Mark Struberg struberg at yahoo.de
Wed Jan 7 07:25:17 EST 2009


txs 4 fwd.

We could possibly also use 2 steps:

1.) try to parse with DateFormat.getDateTimeInstance()
2.) fallback to xs:dateTime format

LieGrue,
strub
----------------------------------------------------------------
“Multiple exclamation marks are a sure sign of a diseased mind!” 
(Sir Terry Pratchett)


--- Gavin King <gavin at hibernate.org> schrieb am Mi, 7.1.2009:

> Von: Gavin King <gavin at hibernate.org>
> Betreff: Re: [webbeans-dev] Question about parsing Date fields in XML based metadata
> An: "Mark Struberg" <struberg at yahoo.de>, "Java Community Process JSR #299 Expert List" <JSR-299-EG at jcp.org>
> CC: webbeans-dev at lists.jboss.org
> Datum: Mittwoch, 7. Januar 2009, 12:41
> Thanks Mark, fwding to the group.
> 
> On Wed, Jan 7, 2009 at 11:40 AM, Mark Struberg
> <struberg at yahoo.de> wrote:
> > Hi!
> >
> > It's a bit late so please excuse me if my
> thoughts/sentences are a bit weird.
> >
> > The web_beans-1.0-pr-spec has the following definition
> in section 9.2.5:
> >> The initial value of a field of type
> java.util.Date or
> >> java.util.Calendar is specified using a format
> that can be
> >> parsed by
> java.text.DateFormat.getDateTimeInstance().parse().
> >
> > Now my question: DateFormat.getDateTimeInstance() is
> Locale aware. This may not always be positive.
> >
> > I'm working on international projects, and if I
> build a WAR in vienna (Locale de_AT), and my colleagues in
> mountain view (Locale US) and Bangalore (maybe Locale hi_IN)
> like to deploy it, then it's very likely that they get
> parsing exceptions for e.g. default values provided via
> web-beans XML definition, isn't it?
> >
> > Shouldn't we better use e.g. the xs:dateTime
> format like in SOAP?
> > http://www.w3.org/TR/xmlschema-2/#dateTime
> >
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
> >
> >
> > Another question:
> > Let's say  I have a Calendar field in
> MyWebBean.java. Which kind of Calendar should it actually
> inject? GregorianCalendar? Or should it throw a
> DefinitionException? (Generall question about handling of 
> abstract members)



      




More information about the weld-dev mailing list