public static <L extends EventListener> void keepListener(Object bean,
            String propertyName, final Class<L> listenerInterface, final L listener) {
        if (!listenerInterface.isInterface()) {
            throw new IllegalArgumentException(
                    listenerInterface + " is not an interface.");
        }

        Object property = getProperty(bean, propertyName);
        if (property != null) {
            addListener(property, listenerInterface, listener);
        }
        addNamedPropertyChangeListener(bean, propertyName, new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                Object oldValue = evt.getOldValue();
                if (oldValue != null) {
                    removeListener(oldValue, listenerInterface, listener);
                }
                Object newValue = evt.getNewValue();
                if (newValue != null) {
                    addListener(newValue, listenerInterface, listener);
                }
            }
        });
    }