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 Summary
Modifier and TypeMethodDescriptionvoid
onEvent
(PropertyEvent aEvent) This is a catch-all (lambda) method for all events.default void
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
Whenever a property is deleted (as ofMap.remove(Object)
) in the relatedObservableProperties
instance, then this method is invoked on the listener.default void
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 Details
-
onEvent
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
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
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
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()
)
-