public static <T> void fireValueChange(T data,
List<WeakReference<ITangoWidgetListener>> listeners) {
if (data != null && listeners != null && !listeners.isEmpty()) {
Iterator<WeakReference<ITangoWidgetListener>> iterator = listeners.iterator();
ITangoWidgetListener widgetListener = null;
while (iterator.hasNext()) {
widgetListener = iterator.next().get();
if (widgetListener != null) {
if (Boolean.class.isAssignableFrom(data.getClass())) {
widgetListener.fireBooleanValueChange((Boolean) data);
}
else if (Number.class.isAssignableFrom(data.getClass())) {
widgetListener.fireNumberValueChange((Number) data);
}
else if (String.class.isAssignableFrom(data.getClass())) {
widgetListener.fireStringValueChange((String) data);
}
}
}
}
}