dukeboard/kevoree-modeling-framework

Being able to find an attribute by path (in a ModelElementListener)

jackybourgeois opened this issue · 1 comments

Hello,

I'd like being able to add a ModelElementListener directly on an attribute instead of getting the higher level and then access my attribute via .getMyAttribute()

For example, a House with Devices. I want to get directly the attribute electricLoad (type ELong) in Device such as: /devices[mydevice]/electricLoad

KMFContainer kmfContainer = _factory.lookup("/devices[mydevice]/electricLoad");
kmfContainer.addModelElementListener(modelEvent -> doSomething((Long)modelEvent.getValue()));

instead of

KMFContainer kmfContainer = _factory.lookup("/devices[mydevice]");
kmfContainer.addModelElementListener(modelEvent -> doSomething(((Device)modelEvent.getValue()).getElectricLoad());

If the issue is about performance, would it be better to provide the attribute type as param?

Jacky

New API for model listener fix the issue