Interface PropertiesObserver

All Superinterfaces:
org.refcodes.observer.Observer<PropertyEvent>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface PropertiesObserver extends org.refcodes.observer.Observer<PropertyEvent>
Defines an observer to be registered to an ObservableProperties (or one of its sub-classes) instance via Observable.subscribeObserver(Object).
  • Method Details

    • onEvent

      void onEvent(PropertyEvent aEvent)
      This is a catch-all (lambda) method for all events. You can provide a lambda expression when calling Observable.subscribeObserver(Object), thereby implementing this catch-all method. Whenever a property changes (create, update, delete) in the related ObservableProperties instance, then this method is invoked on the listener. The PropertyAction accessible via ActionAccessor.getAction() details the operation in question.
      Specified by:
      onEvent in interface org.refcodes.observer.Observer<PropertyEvent>
      Parameters:
      aEvent - An event implementing the PropertyEvent e.g. PropertyCreatedEvent, PropertyUpdatedEvent, PropertyDeletedEvent.
    • onPropertyCreatedEvent

      default void onPropertyCreatedEvent(PropertyCreatedEvent aEvent)
      Whenever a property is created (as of Keys.MutableValues.put(Object, Object)) in the related ObservableProperties instance, then this method is invoked on the listener.
      Parameters:
      aEvent - A PropertyCreatedEvent representing the Property which has been created (as of KeyAccessor.getKey() and ValueAccessor.getValue())
    • onPropertyUpdatedEvent

      default void onPropertyUpdatedEvent(PropertyUpdatedEvent aEvent)
      Whenever an existing property (as of Keys.containsKey(Object)) is updated in the related ObservableProperties instance (as of Keys.MutableValues.put(Object, Object) or the like), then this method is invoked on the listener.
      Parameters:
      aEvent - A PropertyUpdatedEvent representing the Property which has been updated (as of KeyAccessor.getKey(), ValueAccessor.getValue() and PropertyUpdatedEvent.getPreviousValue()).
    • onPropertyDeletedEvent

      default void onPropertyDeletedEvent(PropertyDeletedEvent aEvent)
      Whenever a property is deleted (as of Map.remove(Object)) in the related ObservableProperties instance, then this method is invoked on the listener.
      Parameters:
      aEvent - A PropertyDeletedEvent representing the Property which has been removed (as of KeyAccessor.getKey() and ValueAccessor.getValue())