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 26373848 for webobjects-dev@wocommunity.org; Mon, 30 Aug 2021 16:29:19 +0200 Received-SPF: pass receiver=post.selbstdenker.com; client-ip=64.147.123.20; envelope-from=listfez@dakri.com Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id B19103200302 for ; Mon, 30 Aug 2021 10:28:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 30 Aug 2021 10:28:57 -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=AB8mxfOfHB n7SCIAHURRk4ewT/DY0lBD7nvTqWoY/Ek=; b=gqTWNloTWOlSppBtzax7ouoVpb z2zE3jUwaMzlGm73CitL2wgbtDQkcEGN0jq/MrBOOm/0ZpUFXIVCdKjygmUAw763 UJCE7JisB+2dSw4uE4dBFKS/ii71o7Gwpisk77zbBndqx+bPxXrOCtz+lTtV0UQJ GL0pxczkizZVBB8OmAbPFC7fBGF6KxePkVqZG9w4cKeIt2r2p2T8uqOqIfhMdQHz Z9YLxc+V6Wu89+VlKV1XVYRiW2mXqJpTTv9lU97hBiLpuMdI+qMTIqRK3xXOuDhj ICnZBU3R2zdWevbhXvxBXP9KtojAIY3/5gH44hnUfC92r3dBmWCKzm5kP2pA== 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=AB8mxfOfHBn7SCIAHURRk4ewT/DY0lBD7nvTqWoY/ Ek=; b=a8cklb4qXm79nYvX0pbuEi6Ufq2lwC/ZR11nwQu8i7Wa7lEf5mI0Ocxew i5nzqXuDGWdtiVgU/nu1GNhagzqF/fj0Ew6cQpLeOHFe7L4i9gV7EmNYNvec6zLq 29OEYGqOc5S7BnROKJE6HbSMQmECJzzMqvnm2yiVaSliito27Xwba43aKZorO45F Msf6jbGwGGMsAMmhArlfBtdy6APBpFLwlXUIDqAQth+gd57dbW9jDefrrKAlSf1J w0F5QYvlGCcY4FJ1w/gU8yCyfzglIwAX2jl01ByjxfpVq1vRk5UowHLH2HVvWxSy 6T7jE5MEvg7Gx/KVmwy0B+Nv+ruww== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudduledgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptgfghfggufffkfhfjgfvofesthhqmhdthhdtjeenucfhrhhomhephfgrihii vghlucffrghkrhhiuceolhhishhtfhgviiesuggrkhhrihdrtghomheqnecuggftrfgrth htvghrnhephfejtdeljefgfefgfeeuieelvdevjeeiuedthfffhefhueeggfegkeeiteeg leegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplh hishhtfhgviiesuggrkhhrihdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Mon, 30 Aug 2021 10:28:56 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (1.0) Subject: Re: [WO-DEV] ERXGenericRecord takeValueForKey Date: Mon, 30 Aug 2021 09:28:55 -0500 Message-Id: <548DCB9C-77E0-4D13-A278-B92DE085F706@dakri.com> References: In-Reply-To: To: WebObjects & WOnder Development X-Mailer: iPad Mail (18G82) If your EOs are inheriting from EOGenericRecord, they most likely are implem= enting EOKeyValueCoding, which is an extension to NSKeyValueCoding that uses= a couple of special methods to set/retrieve model properties: - takeStoredValueForKey() - storedValueForKey() If you want your EO to behave using standard NSKeyValueCoding rules, try ove= rriding canAccessFieldsDirectly() in your EO class (static method) to return= false.=20 F --=20 Faizel Dakri > 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???tak= eValueForKey=E2=80=9D (naturally), but I *never ever* see =E2=80=9C???handle= TakeValueForUnboundKey=E2=80=9C for any key amongst modelled attributes. Not= hing other (known to me) gets called =E2=80=94 not even takeStoredValueForKe= y, which I've also overridden to log =E2=80=94, but the value is set all rig= ht 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.ta= keValueForKey which recognises modelled attributes in EOGenericRecord and fi= ll 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