Interface ProxyDelegate<DelegateT>

Type Parameters:
DelegateT -

public interface ProxyDelegate<DelegateT>
Provides a delegate type for any interface allowing the underlying implementation to be swapped out as necessary. The swapping of the delegate is thread safe, but the delegated type may not be.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the underlying delegated type.
    static <ProxyDelegateT>
    ProxyDelegate<ProxyDelegateT>
    getProxy(Class<ProxyDelegateT> proxyDelegateTClass)
     
    start(Supplier<DelegateT> delegateTSupplier)
    Starts the delegate with the delegate suppler.
    Stops the delegated type, returning the delegate
  • Method Details

    • getProxy

      DelegateT getProxy()
      Gets the underlying delegated type.
      Returns:
      the delegate, or null
    • stop

      DelegateT stop()
      Stops the delegated type, returning the delegate
      Returns:
    • start

      DelegateT start(Supplier<DelegateT> delegateTSupplier)
      Starts the delegate with the delegate suppler. This will not invoke the supplier unless the instance is in the state to accept the delegate.
      Parameters:
      delegateTSupplier - the suppleir
      Returns:
      the delegated type
      Throws:
      IllegalStateException - if there is already a delegate
    • getProxy

      static <ProxyDelegateT> ProxyDelegate<ProxyDelegateT> getProxy(Class<ProxyDelegateT> proxyDelegateTClass)