class MetricObserverUtil {

    public static boolean addMetricObservers(Registry registry, MetricObserver... metricObservers) {
        boolean flag = false;
        if (registry instanceof LookoutRegistry) {
            for (MetricObserver metricObserver : metricObservers) {
                ((LookoutRegistry) registry).addMetricObserver(metricObserver);
            }
            flag = true;
        }
        if (registry instanceof CompositeRegistry) {
            for (Registry reg : ((CompositeRegistry) registry).getRegistries()) {
                if (reg instanceof LookoutRegistry) {
                    for (MetricObserver metricObserver : metricObservers) {
                        ((LookoutRegistry) reg).addMetricObserver(metricObserver);
                    }
                    flag = true;
                }
            }
        }
        return flag;
    }

    private  MetricObserverUtil();

}