@SuppressWarnings("unchecked")
    private List<ListenerRegistration> addListenerToRegistry() {
        List<ListenerRegistration> registrationsBuilder = newArrayList();
        for (Pair<IdMatcher, Watcher> guiceWatcherRegistration : getRegisteredWatchers()) {
            Watcher watcher = guiceWatcherRegistration.right();
            IdMatcher idMatcher = guiceWatcherRegistration.left();
            Registration registration = registry.addWatcher(idMatcher, watcher);
            ListenerRegistration listenerRegistration = new ListenerRegistration(registration, idMatcher, watcher);
            registrationsBuilder.add(listenerRegistration);
        }
        return registrationsBuilder;
    }
@ SuppressWarnings ( "unchecked" ) private List < ListenerRegistration > addListenerToRegistry ( ) { List < ListenerRegistration > registrationsBuilder = newArrayList ( ) ; for ( Pair < IdMatcher , Watcher > guiceWatcherRegistration : getRegisteredWatchers ( ) ) { Watcher watcher = guiceWatcherRegistration . right ( ) ; IdMatcher idMatcher = guiceWatcherRegistration . left ( ) ; Registration registration = registry . addWatcher ( idMatcher , watcher ) ; ListenerRegistration listenerRegistration = new ListenerRegistration ( registration , idMatcher , watcher ) ; registrationsBuilder . add ( listenerRegistration ) ; } return registrationsBuilder ; }
enforce creation of all watcher before register it