Hi,

I am working on adding typesafe enum support to JDO. It seems like the way to go with this is to write a new FieldHandler for enums and create it as appropriate in MappingLoader/JDOMappingLoader. This is working okay, until I try to actually execute it :). The problem is that in SQLEngine and ClassMolder, there are a number of places where the FieldHandler for a field is explicitly casted to a FieldHandlerImpl. I can't make my new handler a subclass of FieldHandlerImpl, because FieldHandlerImpl is final.

[I don't think I need to point out that this is poor design. Why separate interface and implementation if you are just going to assume that the interface is always implemented by the same class?]

To fix this, it seems to be the best option would be to define a subinterface of FieldHandler that contains the methods SQLEngine is trying to get from FieldHandlerImpl. (Mostly, it seems, methods having to do with TypeConvertors.) We could then make it a requirement that field handlers that will be used with JDO must implement that interface.

I am going to go ahead with this, but I would appreciate it if someone (maybe Bruce?) would let me know if there's another way the castor team would prefer.

Thanks,
Rhett

--
Rhett Sutphin
Research Assistant (Software)
Coordinated Laboratory for Computational Genomics
and the Center for Macular Degeneration
University of Iowa - Iowa City, IA 52242 - USA
4111 MEBRF - email: [EMAIL PROTECTED]

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev

Reply via email to