Class LifecycledCallbackHandler<T>
java.lang.Object
sawfowl.regionguard.implementsapi.worldedit.cui.handle.utils.LifecycledCallbackHandler<T>
- All Implemented Interfaces:
Lifecycled.Events<T>
Convenience class for implementing the callbacks of
Lifecycled.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidFireonInvalidated(Object, BiConsumer)callbacks.voidFireonNewValue(Object, BiConsumer)callbacks, theLifecycled.value()must be available.<O> voidonInvalidated(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) Add a callback for when this lifecycled is invalidated.<O> voidonNewValue(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.EventsAdd 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:
onInvalidatedin 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.EventsAdd 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:
onNewValuein 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.
-