Re: little suggestion about "instanceof"

2004-07-26 Thread David Zejda
Imagine, you use the DummyCalendar in Calendar2DateFieldConversion. javaToSql will be ok. (... if (source instanceof Calendar) ...) but sqlToJava will materialize not the DummyCalendar (that you need), but a GregorianCalendar. (... GregorianCalendar cal = new GregorianCalendar()...) public cla

RE: little suggestion about "instanceof"

2004-07-26 Thread Charles Anthony
> Imagine, you use the DummyCalendar in Calendar2DateFieldConversion. > > javaToSql will be ok. > (... if (source instanceof Calendar) ...) > > but sqlToJava will materialize not the DummyCalendar (that you need), > but a GregorianCalendar. > (... GregorianCalendar cal = new GregorianCalenda

Re: little suggestion about "instanceof"

2004-07-26 Thread David Zejda
Thanks for a suggestion! There is a nice article, where (in the second part) the result of improper instanceof check in inheritance hierarchy is demonstrated. http://www.javaworld.com/javaworld/jw-01-1999/jw-01-object.html David Jakob Braeuchi wrote: hi david, the instanceof is some kind of stand

Re: little suggestion about "instanceof"

2004-07-26 Thread David Zejda
Thanks for your testcase. Imagine, you use the DummyCalendar in Calendar2DateFieldConversion. javaToSql will be ok. (... if (source instanceof Calendar) ...) but sqlToJava will materialize not the DummyCalendar (that you need), but a GregorianCalendar. (... GregorianCalendar cal = new GregorianC

Re: little suggestion about "instanceof"

2004-07-26 Thread Jakob Braeuchi
hi david, the instanceof is some kind of standard implemenation for equals(). see Effective Java by Josh Bloch. jakob David Zejda schrieb: I think, it would be better to use something like ((source != null) && (source.getClass()==Calendar.class)) { ... in conversion strategies than if (source

RE: little suggestion about "instanceof"

2004-07-26 Thread Charles Anthony
> > Just for curiosity what is the purpose of you own calendar class ? > > from Calendar apidoc: > Subclasses of Calendar interpret a Date according to the rules of a > specific calendar system. The platform provides one concrete > subclass of > Calendar: GregorianCalendar. Future subclasses c

Re: little suggestion about "instanceof"

2004-07-26 Thread David Zejda
... David Guillaume -Message d'origine- De : David Zejda [mailto:[EMAIL PROTECTED] Envoye : samedi 24 juillet 2004 07:59 A : OJB Users List Objet : little suggestion about "instanceof" I think, it would be better to use something like ((source != null) && (source.getClass

RE: little suggestion about "instanceof"

2004-07-26 Thread Guillaume Nodet
4 juillet 2004 07:59 > A : OJB Users List > Objet : little suggestion about "instanceof" > > > I think, it would be better to use something like > > ((source != null) && (source.getClass()==Calendar.class)) > { > ... > >

little suggestion about "instanceof"

2004-07-23 Thread David Zejda
I think, it would be better to use something like ((source != null) && (source.getClass()==Calendar.class)) { ... in conversion strategies than if (source instanceof Calendar) { ... to avoid reducing e.g. custom Calendar subclass to Calendar during conversion. David --