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 anObservableProperties
(or one of its sub-classes) instance viaObservable.subscribeObserver(Object)
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
onEvent(PropertyEvent aEvent)
This is a catch-all (lambda) method for all events.default void
onPropertyCreatedEvent(PropertyCreatedEvent aEvent)
Whenever a property is created (as ofKeys.MutableValues.put(Object, Object)
) in the relatedObservableProperties
instance, then this method is invoked on the listener.default void
onPropertyDeletedEvent(PropertyDeletedEvent aEvent)
Whenever a property is deleted (as ofMap.remove(Object)
) in the relatedObservableProperties
instance, then this method is invoked on the listener.default void
onPropertyUpdatedEvent(PropertyUpdatedEvent aEvent)
Whenever an existing property (as ofKeys.containsKey(Object)
) is updated in the relatedObservableProperties
instance (as ofKeys.MutableValues.put(Object, Object)
or the like), then this method is invoked on the listener.
-
-
-
Method Detail
-
onEvent
void onEvent(PropertyEvent aEvent)
This is a catch-all (lambda) method for all events. You can provide a lambda expression when callingObservable.subscribeObserver(Object)
, thereby implementing this catch-all method. Whenever a property changes (create, update, delete) in the relatedObservableProperties
instance, then this method is invoked on the listener. ThePropertyAction
accessible viaActionAccessor.getAction()
details the operation in question.- Specified by:
onEvent
in interfaceorg.refcodes.observer.Observer<PropertyEvent>
- Parameters:
aEvent
- An event implementing thePropertyEvent
e.g.PropertyCreatedEvent
,PropertyUpdatedEvent
,PropertyDeletedEvent
.
-
onPropertyCreatedEvent
default void onPropertyCreatedEvent(PropertyCreatedEvent aEvent)
Whenever a property is created (as ofKeys.MutableValues.put(Object, Object)
) in the relatedObservableProperties
instance, then this method is invoked on the listener.- Parameters:
aEvent
- APropertyCreatedEvent
representing theProperty
which has been created (as ofKeyAccessor.getKey()
andValueAccessor.getValue()
)
-
onPropertyUpdatedEvent
default void onPropertyUpdatedEvent(PropertyUpdatedEvent aEvent)
Whenever an existing property (as ofKeys.containsKey(Object)
) is updated in the relatedObservableProperties
instance (as ofKeys.MutableValues.put(Object, Object)
or the like), then this method is invoked on the listener.- Parameters:
aEvent
- APropertyUpdatedEvent
representing theProperty
which has been updated (as ofKeyAccessor.getKey()
,ValueAccessor.getValue()
andPropertyUpdatedEvent.getPreviousValue()
).
-
onPropertyDeletedEvent
default void onPropertyDeletedEvent(PropertyDeletedEvent aEvent)
Whenever a property is deleted (as ofMap.remove(Object)
) in the relatedObservableProperties
instance, then this method is invoked on the listener.- Parameters:
aEvent
- APropertyDeletedEvent
representing theProperty
which has been removed (as ofKeyAccessor.getKey()
andValueAccessor.getValue()
)
-
-