Class AbstractProxier<PS extends ProxySpecification>

java.lang.Object
org.microbean.proxy.AbstractProxier<PS>
Type Parameters:
PS - the ProxySpecification type
Direct Known Subclasses:
AbstractReflectiveProxier, AbstractToolkitProxier

public abstract sealed class AbstractProxier<PS extends ProxySpecification> extends Object permits AbstractReflectiveProxier<PS>, AbstractToolkitProxier<PS,T>
An abstract base class for subclassses that create proxies.
Author:
Laird Nelson
  • Constructor Details

  • Method Details

    • classLoader

      protected ClassLoader classLoader()
      Returns the ClassLoader for loading classes.

      The default implementation of this method returns the return value of an invocation of the Thread.getContextClassLoader() method.

      Overrides of this method must not return null or undefined behavior may result.

      Returns:
      a non-null ClassLoader
    • domain

      protected final Domain domain()
      Returns the Domain supplied at construction time.
      Returns:
      a non-null Domain
    • proxy

      public abstract <R> Proxy<R> proxy(PS ps, Supplier<? extends R> instanceSupplier)
      Returns a Proxy appropriate for the supplied proxy specification and Supplier of contextual instances.
      Type Parameters:
      R - the contextual instance type
      Parameters:
      ps - an appropriate proxy specification; must not be null
      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