@Test public void removeAllChangeListeners() { final B entity = new B(); final EntityChangeBroker broker = new EntityChangeBroker(); final EntityChangeEmitter emitter = broker.getEmitter(); final RecordingListener instanceListener = new RecordingListener(); broker.addChangeListener( entity, instanceListener ); assertEntityAddedEventCount( instanceListener, 0 ); emitter.entityAdded( entity ); assertEntityAddedEventCount( instanceListener, 1 ); assertEntityAddedEvent( instanceListener.getEntityAddedEvents().get( 0 ), entity ); instanceListener.clear(); broker.removeAllChangeListeners( entity ); assertEntityAddedEventCount( instanceListener, 0 ); emitter.entityAdded( entity ); assertEntityAddedEventCount( instanceListener, 0 ); }
public void removeAllChangeListeners( @Nonnull final Object object ) { if ( isSending() ) { _deferredListenerActions.add( new DeferredListenerAction( object, null, ActionType.REMOVE ) ); } else { final ListenerEntry[] listenerEntries = _objectListeners.get( object ); if ( null != listenerEntries ) { for ( final ListenerEntry entry : listenerEntries ) { doRemoveObjectChangeListener( object, entry ); } } } }
EntityChangeBroker { public void removeAllChangeListeners( @Nonnull final Object object ) { if ( isSending() ) { _deferredListenerActions.add( new DeferredListenerAction( object, null, ActionType.REMOVE ) ); } else { final ListenerEntry[] listenerEntries = _objectListeners.get( object ); if ( null != listenerEntries ) { for ( final ListenerEntry entry : listenerEntries ) { doRemoveObjectChangeListener( object, entry ); } } } } }
EntityChangeBroker { public void removeAllChangeListeners( @Nonnull final Object object ) { if ( isSending() ) { _deferredListenerActions.add( new DeferredListenerAction( object, null, ActionType.REMOVE ) ); } else { final ListenerEntry[] listenerEntries = _objectListeners.get( object ); if ( null != listenerEntries ) { for ( final ListenerEntry entry : listenerEntries ) { doRemoveObjectChangeListener( object, entry ); } } } } EntityChangeBroker(); }
EntityChangeBroker { public void removeAllChangeListeners( @Nonnull final Object object ) { if ( isSending() ) { _deferredListenerActions.add( new DeferredListenerAction( object, null, ActionType.REMOVE ) ); } else { final ListenerEntry[] listenerEntries = _objectListeners.get( object ); if ( null != listenerEntries ) { for ( final ListenerEntry entry : listenerEntries ) { doRemoveObjectChangeListener( object, entry ); } } } } EntityChangeBroker(); void addChangeListener( @Nonnull final EntityChangeListener listener ); void addChangeListener( @Nonnull final Class<?> clazz,
                                 @Nonnull final EntityChangeListener listener ); void addChangeListener( @Nonnull final Object entity, @Nonnull final EntityChangeListener listener ); void removeChangeListener( @Nonnull final EntityChangeListener listener ); void removeChangeListener( @Nonnull final Object entity, @Nonnull final EntityChangeListener listener ); void removeAllChangeListeners( @Nonnull final Object object ); void removeChangeListener( @Nonnull final Class<?> clazz,
                                    @Nonnull final EntityChangeListener listener ); void purgeChangeListener( @Nonnull final EntityChangeListener listener ); @Nonnull EntityBrokerLock pause(); boolean isPaused(); boolean isEnabled(); }
EntityChangeBroker { public void removeAllChangeListeners( @Nonnull final Object object ) { if ( isSending() ) { _deferredListenerActions.add( new DeferredListenerAction( object, null, ActionType.REMOVE ) ); } else { final ListenerEntry[] listenerEntries = _objectListeners.get( object ); if ( null != listenerEntries ) { for ( final ListenerEntry entry : listenerEntries ) { doRemoveObjectChangeListener( object, entry ); } } } } EntityChangeBroker(); void addChangeListener( @Nonnull final EntityChangeListener listener ); void addChangeListener( @Nonnull final Class<?> clazz,
                                 @Nonnull final EntityChangeListener listener ); void addChangeListener( @Nonnull final Object entity, @Nonnull final EntityChangeListener listener ); void removeChangeListener( @Nonnull final EntityChangeListener listener ); void removeChangeListener( @Nonnull final Object entity, @Nonnull final EntityChangeListener listener ); void removeAllChangeListeners( @Nonnull final Object object ); void removeChangeListener( @Nonnull final Class<?> clazz,
                                    @Nonnull final EntityChangeListener listener ); void purgeChangeListener( @Nonnull final EntityChangeListener listener ); @Nonnull EntityBrokerLock pause(); boolean isPaused(); boolean isEnabled();  }