Interface Mutable

All Known Subinterfaces:
BoundFunction<DOMAIN_TYPE,CODOMAIN_TYPE>, ChangingSource<T>, MutableDisplayable, MutableIconProvider, PresentationModel
All Known Implementing Classes:
AndFunction, BooleanBoundFunctionSupport, BoundFunctionSupport, BoundProperty, CopyIfEmptyOrConform, MutableIconProviderSupport, NonEmptyFunction, OrFunction, UnaryBoundFunctionSupport, WeakCopyFunctionSupport

@API(status=EXPERIMENTAL) public interface Mutable
An interface that describes the capability of mutate status and of supporting listeners. Both old-style PropertyChangeListener and a new experimental MutableListeners are supported. The three different methods addListener1(MutableListener1), addListener2(MutableListener2) and addListener(MutableListener) allow shorter syntaxes when only one or two parameters of the callback are needed, that is:
 
 mutable.addMutableListener1(newValue -> consumer1.accept(newValue));
 mutable.addMutableListener2((oldValue, newValue) -> consumer2.accept(oldValue, newValue));
 mutable.addMutableListener((source, oldValue, newValue) -> consumer3.accept(source, oldValue, newValue));
 
 
Since:
2.0-ALPHA-2
Author:
Fabrizio Giudici
See Also:
  • Method Details

    • addPropertyChangeListener

      void addPropertyChangeListener(@Nonnull PropertyChangeListener listener)
      Parameters:
      listener - the listener
    • addPropertyChangeListener

      void addPropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener)
      Registers a PropertyChangeListener for the given property.
      Parameters:
      propertyName - the name of the property
      listener - the listener
    • removePropertyChangeListener

      void removePropertyChangeListener(@Nonnull PropertyChangeListener listener)
      Unregisters a PropertyChangeListener.
      Parameters:
      listener - the listener
    • removePropertyChangeListener

      void removePropertyChangeListener(@Nonnull String propertyName, @Nonnull PropertyChangeListener listener)
      Removes a PropertyChangeListener for the given property.
      Parameters:
      propertyName - the name of the property
      listener - the listener
    • getPropertyChangeListeners

      @Nonnull PropertyChangeListener[] getPropertyChangeListeners()
      Returns all the bound PropertyChangeListeners.
      Returns:
      the listeners
    • getPropertyChangeListeners

      @Nonnull PropertyChangeListener[] getPropertyChangeListeners(@Nonnull String propertyName)
      Returns the bound PropertyChangeListeners for the given property.
      Parameters:
      propertyName - the name of the property
      Returns:
      the listeners
    • hasListeners

      boolean hasListeners(@Nonnull String propertyName)
      Checks whether the given property has been bound to listeners.
      Parameters:
      propertyName - the name of the property
      Returns:
      true if the property is bound
    • addListener

      <T> void addListener(@Nonnull MutableListener<T> listener)
      Registers a MutableListener.
      Parameters:
      listener - the listener
    • addListener1

      default <T> void addListener1(@Nonnull MutableListener1<T> listener)
      Registers a MutableListener. This method is needed to allow the compiler to infer the correct type of lambdas.
      Parameters:
      listener - the listener
    • addListener2

      default <T> void addListener2(@Nonnull MutableListener2<T> listener)
      Registers a MutableListener. This method is needed to allow the compiler to infer the correct type of lambdas.
      Parameters:
      listener - the listener
    • removeListener

      <T> void removeListener(@Nonnull MutableListener<T> listener)
      Unregisters a MutableListener.
      Parameters:
      listener - the listener