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: "Faizel Dakri" Received: from wout4-smtp.messagingengine.com ([64.147.123.20] verified) by post.selbstdenker.com (CommuniGate Pro SMTP 6.3.3) with ESMTPS id 26373865 for webobjects-dev@wocommunity.org; Mon, 30 Aug 2021 16:35:53 +0200 Received-SPF: pass receiver=post.selbstdenker.com; client-ip=64.147.123.20; envelope-from=listfez@dakri.com Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id DF13732009D3 for ; Mon, 30 Aug 2021 10:35:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 30 Aug 2021 10:35:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dakri.com; h= content-type:content-transfer-encoding:from:mime-version:subject :date:message-id:references:in-reply-to:to; s=fm1; bh=Oc/jxph6Af TTeS3HA8bMRcNSONy9g3Dy4iZMvojgMRE=; b=vv9KOw5C2swzjS+rXYJ3xPOxZ7 A7lgjYngSkwPZ85iyF9sNrl2hQ6tCSrbsH6GKDz3c8fj7RhmqdJdYuxeFgwc0vBj fAhNASugu1wPgHj/TIbLZnAWPFCCOnNyX+/dWRTrteODh3v88NVGAPu8ZbcUB2kD 8wY/MyiOzCKMuMmlDePhKXURH6RzkOmxkLll/u+qqhnjP9B/yw/Tilxvw/SbOdLG GkSOyDXQ10neJWJWel4/Dagv2NZYmuDRBE2cxsYBzp7tdRAVS7Sw6Y4ImeLHrKL0 /obf3uvuOYzO8q5nClBp2u5i7sfZuPokqd+xaFf/OGDXKhnTEL7OxOqHmIWA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=Oc/jxph6AfTTeS3HA8bMRcNSONy9g3Dy4iZMvojgM RE=; b=S8figo/ollNMnIPKJy+YPJU6e3vd7nMJmDz5ySELxBzDCZ8ITk8qV1M7j fQ7fDAPCS6QUFkWJXeeidfU3o+qkztNYBDCKxmsEjjw50rMy3Wvs8zkRL3BTXSaT PBecfkWzldutvph6jAvpvXkW7ZmMth2//7L6eO2s8iCLOCy7VT2YUyM2n2TPAJke EzDRUQPLxBhPRo7IfDl8ZkfIJZTBSlh34MDxrkJYlMIU7rOF7AbmMDqv5Nl9H3KS a+qVquJTCd8Gwk6SRTWVcbv0Ot75anj9+QJxUGcXjcr/wBB8PznKfqXDGccwTtnV MNIpUs/KrYbqYIgrsebj0guijdtOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudduledgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptgfghfggufffkfhfjgfvofesthhqmhdthhdtjeenucfhrhhomhephfgrihii vghlucffrghkrhhiuceolhhishhtfhgviiesuggrkhhrihdrtghomheqnecuggftrfgrth htvghrnhephfejtdeljefgfefgfeeuieelvdevjeeiuedthfffhefhueeggfegkeeiteeg leegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplh hishhtfhgviiesuggrkhhrihdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 30 Aug 2021 10:35:30 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Re: [WO-DEV] Re: ERXGenericRecord takeValueForKey Date: Mon, 30 Aug 2021 09:35:29 -0500 Message-Id: <415CC763-461E-4E68-A0BA-7D516AC5F19E@dakri.com> References: In-Reply-To: To: WebObjects & WOnder Development X-Mailer: iPad Mail (18G82) Oops, sorry, I see that you=E2=80=99re already overriding canAccessFieldsDir= ectly() to return false.=20 F --=20 Faizel Dakri > On Aug 30, 2021, at 9:29 AM, Faizel Dakri = wrote: >=20 > =EF=BB=BFIf your EOs are inheriting from EOGenericRecord, they most likely= are implementing EOKeyValueCoding, which is an extension to NSKeyValueCodin= g that uses a couple of special methods to set/retrieve model properties: >=20 > - takeStoredValueForKey() > - storedValueForKey() >=20 > If you want your EO to behave using standard NSKeyValueCoding rules, try o= verriding canAccessFieldsDirectly() in your EO class (static method) to retu= rn false.=20 >=20 > F >=20 > --=20 > Faizel Dakri >=20 >=20 >> On Aug 25, 2021, at 8:50 PM, webobjects-dev@wocommunity.org wrote: >>=20 >> =EF=BB=BFHi there, >>=20 >> I must be missing something darn obvious; looks like I've missed EOF 101 s= omehow :/ >>=20 >> My EO class, which extends ERXGenericRecord, does not implement modelled p= roperty setters. Thus, I assumed takeValueForKey would always fall through h= andleTakeValueForUnboundKey. Seems not. >>=20 >> I've overridden the methods like this: >>=20 >> =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 takeStoredValueFo= rKey), not relevant, for it is never called >> } >> ... >> } >> =3D=3D=3D >>=20 >> It does NOT work as (I've na=C3=AFvely) presumed. >>=20 >> When eo.takeValueForKey(o,key) is called, I can always see =E2=80=9C???ta= keValueForKey=E2=80=9D (naturally), but I *never ever* see =E2=80=9C???handl= eTakeValueForUnboundKey=E2=80=9C for any key amongst modelled attributes. No= thing other (known to me) gets called =E2=80=94 not even takeStoredValueForK= ey, which I've also overridden to log =E2=80=94, but the value is set all ri= ght in the EO. >>=20 >> Only if foo is a random (non-existing, non-modelled) string, I can see =E2= =80=9C???handleTakeValueForUnboundKey=E2=80=9C. >>=20 >> Looks like there's some trick in NSKeyValueCoding.DefaultImplementation.t= akeValueForKey which recognises modelled attributes in EOGenericRecord and f= ill their values directly, without falling to handleTakeValueForUnboundKey?!= ? Weird. >>=20 >> Or I must be doing something very far wrong. >>=20 >> Is this documented somewhere? Far as I can say, neither ERXGenericRecord n= or EOGenericRecord nor NSKeyValueCoding.DefaultImplementation mentions anyth= ing special; NSKeyValueCoding.DefaultImplementation.takeValueForKey should s= imply check for the accessor (either with or without the _ prefix) and if th= ere is none (which there indeed is not), fall to handleTakeValueForUnboundKe= y. What am I missing here? >>=20 >> Thanks, >> OC >>=20 >>=20 >>=20 >> ############################################################# >> This message is sent to you because you are subscribed to >> the mailing list . >> To unsubscribe, E-mail to: >> To switch to the DIGEST mode, E-mail to >> To switch to the INDEX mode, E-mail to >> Send administrative queries to >>=20 >>=20 >=20 >=20 > ############################################################# > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > To switch to the DIGEST mode, E-mail to > To switch to the INDEX mode, E-mail to > Send administrative queries to >=20