use of org.openhab.binding.astro.internal.util.ItemIterator.ItemIteratorCallback in project openhab1-addons by openhab.
the class PlanetPublisher method publish.
/**
* Iterates through all items and publishes the states.
*/
public void publish(final PlanetName planetName) {
final Planet planet = context.getPlanet(planetName);
new ItemIterator().iterate(new ItemIteratorCallback() {
@Override
public void next(AstroBindingConfig bindingConfig, Item item) {
if (planetName == bindingConfig.getPlanetName()) {
try {
Object value = PropertyUtils.getPropertyValue(planet, bindingConfig.getPlanetProperty());
if (!equalsCachedValue(value, item)) {
publishValue(item, value, bindingConfig);
itemCache.put(item.getName(), value);
}
} catch (Exception ex) {
logger.warn(ex.getMessage(), ex);
}
}
}
});
}
Aggregations