Mind you I have not TRIED this yet, but my understanding is that, yes, you can provide a factory that can do the conversion. 5.4 has:

 void   setAdaptorValueConversionClassName(String conversionClassName)
Sets the name of the class used to convert a custom class to a primitive type to conversionMethodName.
 void   setAdaptorValueConversionMethodName(String conversionMethodName)
Sets the name of the method used to convert a custom class to a primitive type to conversionMethodName.

rather than just the method name, so you aren't as restricted with your conversions. Before classes like Boolean worked, because it happens to have a static method on it for one way, and happens to have the conversion method back the other way, but if you wanted to do my example of CryptoString, you really couldn't without manually munging it around as a regular String in your get/set methods. The new 5.4 API should make it possible to define these conversions purely with an EOModel definition (and the factory class, but only defined in one place).

ms

On Jan 2, 2008, at 6:58 PM, Pierce T. Wetter III wrote:


On Jan 2, 2008, at 2:47 PM, Mike Schrag wrote:

It might be possible now using the new enum support in 5.4, but only as a hack, and I haven't looked at it.
It should, actually ... The bug I filed that I /think/ turned into this feature was to be able to do "CryptoString" that properly maps in and out of the DB, which is basically the same issue you're referring to but just with dates.

Yeah, then you could store dates in the database as INTEGERs, and have a class to map to/from timestamps as needed. So its not just enums in 5.4, you can map attributes in general? The release note says "support for enum in attribute conversion", but I had no idea of the details.

Pierce

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to