Modeling Framework包含的基本都是模型信息.
在各YYY类的setAttributeName()方法中都有:
if
(eNotificationRequired())
eNotify(new ENotificationImpl(this, //Notifier
eNotify(new ENotificationImpl(this, //Notifier
Notification.SET,
PurchasePackage.ITEM__PRICE,
oldPrice,
price));
每个Eobjcet(就是YYY)都会维持一张observer list,那么如果eNotificationRequired为true,那么表明需要进行notify.这个eNotify会iterate整个list并发送notfication,并且在参数中可以看出,YYY是作为notifier传递出去的.
再来看:在XXX.util包中的XXXAdapterFactory.createAdapter(Notifier target)中,target就是YYY(如purchaseOrder或Item),那么利用XXX.util包中的XXXSwitch进行判断target是什么,然后根据其类型生成相应的adapter.为一个Eobject添加一个observer:
Adapter poObserver =
...
aPurchaseOrder.eAdapters().add(poObserver);//aPurchaseOrder就是一个YYY的instance
aPurchaseOrder.eAdapters().add(poObserver);//aPurchaseOrder就是一个YYY的instance
//都被add到eAdapters list
在EMF中observer也是adapter,身兼2个功能,确切的说应该是adapter同时也是observer,毕竟关键字都是adapter.