Guillaume Nodet wrote:
Maybe for the GregorianCalendar as Calendar is an abstract class... You really use a custom calendar class ?
No, I don't. I only looked on convstrategies to get a bit of inspiration for my own ones and noticed that..
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 could represent the various types of lunar calendars in use in many parts of the world.
..so there are more calendars planned in JDK and also there is no guarantee, that there are no other custom subclasses yet.
I think it's a general rule, to take into accout subclasses, everywhere applicable (~ not final classes), esp. in tools, libraries, frameworks...
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()==Calendar.class)) { ...
in conversion strategies than
if (source instanceof Calendar) { ...
to avoid reducing e.g. custom Calendar subclass to Calendar during conversion.
David
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
