Class LifecycledCallbackHandler<T>
java.lang.Object
com.sk89q.worldedit.util.lifecycle.LifecycledCallbackHandler<T>
- All Implemented Interfaces:
Lifecycled.Events<T>
Convenience class for implementing the callbacks of
Lifecycled
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
FireonInvalidated(Object, BiConsumer)
callbacks.void
FireonNewValue(Object, BiConsumer)
callbacks, theLifecycled.value()
must be available.<O> void
onInvalidated
(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) Add a callback for when this lifecycled is invalidated.<O> void
onNewValue
(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) Add a callback for when this lifecycled is given a new value.
-
Constructor Details
-
LifecycledCallbackHandler
-
-
Method Details
-
onInvalidated
Description copied from interface:Lifecycled.Events
Add a callback for when this lifecycled is invalidated. Will be called immediately if this lifecycled is currently invalid.The callback should not reference the owner, it must only access it via the parameter. This ensures that the owner will be GC-able, otherwise it may be stuck in a reference loop.
- Specified by:
onInvalidated
in interfaceLifecycled.Events<T>
- Parameters:
owner
- when the owner is GC'd, the callback is removedcallback
- the callback, will be passed the lifecycled object
-
onNewValue
Description copied from interface:Lifecycled.Events
Add a callback for when this lifecycled is given a new value. Will be called immediately if this lifecycled is currently valid.The callback should not reference the owner, it must only access it via the parameter. This ensures that the owner will be GC-able, otherwise it may be stuck in a reference loop.
- Specified by:
onNewValue
in interfaceLifecycled.Events<T>
- Parameters:
owner
- when the owner is GC'd, the callback is removedcallback
- the callback, will be passed the lifecycled object
-
fireInvalidated
public void fireInvalidated()FireonInvalidated(Object, BiConsumer)
callbacks. -
fireOnNewValue
public void fireOnNewValue()FireonNewValue(Object, BiConsumer)
callbacks, theLifecycled.value()
must be available.
-