Class ReflectiveClientProxier

All Implemented Interfaces:
ClientProxier

An AbstractReflectiveProxier implementation that uses java.lang.reflect.Proxy machinery.
Author:
Laird Nelson
  • Constructor Details

  • Method Details

    • clientProxy

      public <R> R clientProxy(Id id, Supplier<? extends R> instanceSupplier)
      Description copied from interface: ClientProxier
      Returns a contextual reference which is also a Proxy, given a Supplier of contextual instances of the appropriate type.

      Implementations of this method may return null.

      Specified by:
      clientProxy in interface ClientProxier
      Type Parameters:
      R - the type of the contextual reference
      Parameters:
      id - an Id qualifying the contextual instance that will be proxied; must not be null
      instanceSupplier - a Supplier of contextual instances of the appropriate type; must not be null
      Returns:
      a contextual reference, which may be null
      See Also:
    • proxy

      protected final <R> Proxy<R> proxy(ProxySpecification ps, Class<?>[] interfaces, Supplier<? extends R> instanceSupplier)
      Returns a Proxy appropriate for the supplied specification and Supplier of contextual instances.
      Specified by:
      proxy in class AbstractReflectiveProxier<ProxySpecification>
      Type Parameters:
      R - the contextual instance type
      Parameters:
      ps - an appropriate proxy specification; must not be null
      interfaces - the interfaces to implement; every element is guaranteed to be an interface
      instanceSupplier - a Supplier of contextual instances; must not be null; may or may not create a new contextual instance each time it is invoked; may or may not be invoked multiple times depending on the subclass implementation
      Returns:
      a non-null Proxy
      Throws:
      NullPointerException - if any argument is null