Hi,
Kieran Kelleher wrote:
As we know this EOAttribute.validateValue(...) gets called before
custom eo validate<AttributeName> methods and it uses the class
description to validate and/or do basic conversion. What are the
alternatives to find an elegant way to call my custom validate
first or is there none?
Why do I want to do this? I am importing text data from CSV files
and pushing the text values into attributes in an efficient way,
however I can easily handle conversion of YES/NO, T/F, Y/N, Y/null
or TRUE/FALSE strings to Boolean in my custom
validate<BooleanAttribute> methods, but of course EOF gets a shot
at it first when I iterate through the imported values calling
eo.validateTakeValueForKeyPath(aValue, aKey);
I have an alternative in mind, but just wanted to check with the
smart folks first .... any suggestions?
I would personally avoid such solution: it breaks the normal EOF
validation process, and you can potentially have to write lot of
repetitive "validate<Attribute>" methods...
A more generic and reusable solution would be to write CSVReader that
takes a file reference, an array of key paths and an array of
formatters to read CSV column strings, convert them if needed (with
formatter) and set it (with key path and Key Value Coding). I've done
this kind of thing in the past, and it's very handy. You can even
create custom formatters to convert strings to special data (i.e.
BooleanFormat, InetAddressFormat, etc.).
Kind regards,
Francis Labrie, System Architect, OS communications informatiques -
Your communication engine
[EMAIL PROTECTED] | Phone: (450) 676-1238 ext. 27 | Fax: (450) 676-5276
_______________________________________________
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]