X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.22.2a (ClamAV engine v0.102.2) X-Junk-Score: 0 [] X-KAS-Score: 0 [] From: "ocs@ocs.cz" Received: from smtp-beta-1.zoner.com ([217.198.120.8] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.3) with ESMTPS id 26355633 for webobjects-dev@wocommunity.org; Thu, 26 Aug 2021 03:50:30 +0200 Received-SPF: none receiver=post.selbstdenker.com; client-ip=217.198.120.8; envelope-from=ocs@ocs.cz Received: from smtp.zoner.com (smtp.zoner.com [217.198.120.6]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp-beta-1.zoner.com (Postfix) with ESMTPS id 4D73C180017A; Thu, 26 Aug 2021 03:50:10 +0200 (CEST) Received: from smtpclient.apple (unknown [46.167.220.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ocs@ocs.cz) by smtp.zoner.com (Postfix) with ESMTPSA id 22FA03000068; Thu, 26 Aug 2021 03:50:10 +0200 (CEST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.80.0.2.43\)) Date: Thu, 26 Aug 2021 03:50:09 +0200 Subject: ERXGenericRecord takeValueForKey Message-Id: <860EC8B1-6908-400E-BC84-6795F5E39B3C@ocs.cz> To: WebObjects & WOnder Development X-Mailer: Apple Mail (2.3654.80.0.2.43) Hi there, I must be missing something darn obvious; looks like I've missed EOF 101 = somehow :/ My EO class, which extends ERXGenericRecord, does not implement modelled = property setters. Thus, I assumed takeValueForKey would always fall = through handleTakeValueForUnboundKey. Seems not. I've overridden the methods like this: =3D=3D=3D class OCSEnterpriseObject extends ERXGenericRecord { static boolean canAccessFieldsDirectly { NO } void takeValueForKey(value,String key) { println "???takeValueForKey $key" //super.takeValueForKey(value, key) // precisely same behaviour as = with the thing below, no difference = NSKeyValueCoding.DefaultImplementation.takeValueForKey(this,value,key) } void handleTakeValueForUnboundKey(value,String key) { println "???handleTakeValueForUnboundKey $key" // ... some stuff to simulate setter (eventually using = takeStoredValueForKey), not relevant, for it is never called } ... } =3D=3D=3D It does NOT work as (I've na=C3=AFvely) presumed. When eo.takeValueForKey(o,key) is called, I can always see = =E2=80=9C???takeValueForKey=E2=80=9D (naturally), but I *never ever* see = =E2=80=9C???handleTakeValueForUnboundKey=E2=80=9C for any key amongst = modelled attributes. Nothing other (known to me) gets called =E2=80=94 = not even takeStoredValueForKey, which I've also overridden to log =E2=80=94= , but the value is set all right in the EO. Only if foo is a random (non-existing, non-modelled) string, I can see = =E2=80=9C???handleTakeValueForUnboundKey=E2=80=9C. Looks like there's some trick in = NSKeyValueCoding.DefaultImplementation.takeValueForKey which recognises = modelled attributes in EOGenericRecord and fill their values directly, = without falling to handleTakeValueForUnboundKey?!? Weird. Or I must be doing something very far wrong. Is this documented somewhere? Far as I can say, neither ERXGenericRecord = nor EOGenericRecord nor NSKeyValueCoding.DefaultImplementation mentions = anything special; NSKeyValueCoding.DefaultImplementation.takeValueForKey = should simply check for the accessor (either with or without the _ = prefix) and if there is none (which there indeed is not), fall to = handleTakeValueForUnboundKey. What am I missing here? Thanks, OC