[PEAK] adapt based on inheritance
Stephen Haberman
stephenh at chase3000.com
Wed Jun 9 23:04:32 EDT 2004
> What you want is 'declareAdapter(adapterfactory, provides=[IWhatever],
> forObjects=[feature]). That is, you want to declare adapters for the
> specific object(s), not their classes. Inheritance will then do what
> you want here.
Well isn't that pretty cool. I was stuck in the box of "an object is
something I do o = Class()" and couldn't see a feature of
class(model.Attribute) is an object all the same.
> Keep in mind, however, that the use of Collection as a base class for
> multi-valued features is quite optional. Inheriting from Attribute
> and setting the upperBound to a number greater than 1 suffices to make
> the feature multi-valued, and this approach is used in e.g. code
> generated by the 'mof2py' script.
Hm, good point, I hadn't thought of that. I think I'll ignore that as a
boundary case for now.
Thanks,
Stephen
More information about the PEAK
mailing list