[Prev][Next][Index][Thread]

Re: Dylan, MOP, object/relational mapping...









Is this a behaviour of Objective-C or of ProjectBuilder (the RAD IDE that
WebObjects uses)? I'd expect ProjectBuilder to be building the classes with the
accessor methods in for you the way it generates everything else, so this is
probably an IDE/environment feature rather than a language one.
That said, there's probably a couple of strong ways of doing this in Dylan.
You should look at the (iteration) protocol section of the DRM: collections
define collections of methods used in their manipulation, so you could have a
function that analyzes the metadata on a record and generates accessor functions
at runtime then pops them into a hashtable (or other collection). You can then
replace them with customized versions as needed (wrapping the original methods
in your code).
Along with, or rather than this, you can macro up accessors by name/field, and
pass in custom code as part of the macro. No custom code, no custom behaviour.

- Rob.

Scott Ribe wrote:

> Neel Krishnaswami wrote:
>
> > This will work okay no matter what sort of record o is. Or am I
> > misunderstanding something about how the EOGenericRecord class
> > works? (Does it automagically generate "getFoo" and "setFoo"
> > methods depending on the dictionary it contains?)
>
> Yes you're misunderstanding EOGenericRecord. It does automagically
> provide the getFoo and setFoo methods based on the data dictionary. The
> point is that you do NOT have to write the accessor methods unless you
> want them to do something special besides the normal fetching and
> assignment.