Interface ClientProxy<T>

Type Parameters:
T - the proxied type
All Known Implementing Classes:
AbstractClientProxy

public interface ClientProxy<T>
An interface whose implementations pretend to be another type and alter the behavior of instances of that type in some way.

An implementation of this interface must, somehow, be able to be cast to the type of the instance it logically proxies.

Author:
Laird Nelson
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    Returns this ClientProxy, or a completely substitutable replacement for it, cast to the type of the instance it proxies.
    Returns the instance being proxied, not this ClientProxy.
  • Method Details

    • $proxied

      Returns the instance being proxied, not this ClientProxy.
      Returns:
      the instance being proxied; never null; never this
      Idempotency:
      Implementations of this method must be idempotent and deterministic. Specifically, they must always return the instance being proxied, not this or anything else.
      Nullability:
      Implementations of this method must never return null.
      Thread Safety:
      Implementations of this method must be safe for concurrent use by multiple threads.
    • $cast

      default T $cast()
      Returns this ClientProxy, or a completely substitutable replacement for it, cast to the type of the instance it proxies.

      The default implementation of this method returns, effectively, (T)this.

      Returns:
      this ClientProxy; never null
      Throws:
      ClassCastException - if the cast could not take place for any reason; this indicates a violation of this interface's structural contracts by the implementation class
      Idempotency:
      Implementations of this method must be idempotent and deterministic. Specifically, they must always return this ClientProxy or a completely substitutable replacement for it, not anything else.
      Nullability:
      Implementations of this method must never return null.
      Thread Safety:
      Implementations of this method must be safe for concurrent use by multiple threads.