Package 

Class ListenerDelegate

  • All Implemented Interfaces:
    kotlin.properties.ReadOnlyProperty , kotlin.properties.ReadWriteProperty

    
    public final class ListenerDelegate<L extends Object>
     implements ReadWriteProperty<Any, L>
                        

    A property delegate to be used with listeners.

    The real listener stored in realListener isn't exposed externally, it's only accessible through the wrapper.

    The wrapper is exposed by the getter, and a reference to it can be safely stored long-term.

    Setting new listeners via the setter will update the underlying listener, and calls to the wrapper will then be forwarded to the latest realListener that was set.

    • Constructor Summary

      Constructors 
      Constructor Description
      ListenerDelegate(L initialValue, Function1<Function0<L>, L> wrap)
    • Method Summary

      Modifier and Type Method Description
      L getValue(Object thisRef, KProperty<?> property)
      Unit setValue(Object thisRef, KProperty<?> property, L value)
      • Methods inherited from class kotlin.properties.ReadOnlyProperty

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ListenerDelegate

        ListenerDelegate(L initialValue, Function1<Function0<L>, L> wrap)
        Parameters:
        wrap - A function that has to produce the wrapper listener.