Class ReflectiveClientProxier
java.lang.Object
org.microbean.reference.AbstractClientProxier<Class<?>>
org.microbean.reference.ReflectiveClientProxier
- All Implemented Interfaces:
ClientProxier
An
AbstractClientProxier
implementation that uses Proxy
machinery.- Author:
- Laird Nelson
-
Constructor Summary
ConstructorsConstructorDescriptionReflectiveClientProxier
(Domain domain) Creates a newReflectiveClientProxier
.ReflectiveClientProxier
(Domain domain, Function<? super List<? extends Class<?>>, ? extends ClassLoader> clf) Creates a newReflectiveClientProxier
. -
Method Summary
Modifier and TypeMethodDescriptionprotected <R> ClientProxy
<R> instantiate
(ProxySpecification ps, Supplier<? extends R> instanceSupplier) Called indirectly by theAbstractClientProxier.clientProxy(Request, Supplier)
method when a newClientProxy<R>
instance needs to be created, creates a new instance of aClientProxy<R>
that proxies contextual instances supplied by the suppliedinstanceSupplier
, and returns it.protected MethodHandles.Lookup
Returns aMethodHandles.Lookup
suitable for the suppliedClass
.Methods inherited from class org.microbean.reference.AbstractClientProxier
classLoader, clientProxy, clientProxyClass, domain, generate, instantiate
-
Constructor Details
-
ReflectiveClientProxier
Creates a newReflectiveClientProxier
.- Parameters:
domain
- aDomain
; must not benull
- Throws:
NullPointerException
- ifdomain
isnull
- See Also:
-
ReflectiveClientProxier
public ReflectiveClientProxier(Domain domain, Function<? super List<? extends Class<?>>, ? extends ClassLoader> clf) Creates a newReflectiveClientProxier
.- Parameters:
domain
- aDomain
; must not benull
clf
- aFunction
that returns aClassLoader
appropriate for aList
ofClass
instances; must not benull
- Throws:
NullPointerException
- if any argument isnull
-
-
Method Details
-
instantiate
protected <R> ClientProxy<R> instantiate(ProxySpecification ps, Supplier<? extends R> instanceSupplier) Description copied from class:AbstractClientProxier
Called indirectly by theAbstractClientProxier.clientProxy(Request, Supplier)
method when a newClientProxy<R>
instance needs to be created, creates a new instance of aClientProxy<R>
that proxies contextual instances supplied by the suppliedinstanceSupplier
, and returns it.The default implementation of this method eventually calls the
AbstractClientProxier.instantiate(Class, Supplier)
method with the return value of an indirect invocation of theAbstractClientProxier.clientProxyClass(Object, ClassLoader)
method and the suppliedSupplier
and returns the result.Overrides of this method that do something entirely different are not obligated to call the
AbstractClientProxier.clientProxyClass(Object, ClassLoader)
method or theAbstractClientProxier.instantiate(Class, Supplier)
method. In such a case, those methods will be effectively orphaned.- Overrides:
instantiate
in classAbstractClientProxier<Class<?>>
- Type Parameters:
R
- the type of contextual instance being proxied- Parameters:
ps
- aProxySpecification
; must not benull
instanceSupplier
- aSupplier
of contextual instances of the<R>
type; must not benull
- Returns:
- a non-
null
ClientProxy<R>
- See Also:
-
lookup
Description copied from class:AbstractClientProxier
Returns aMethodHandles.Lookup
suitable for the suppliedClass
.- Specified by:
lookup
in classAbstractClientProxier<Class<?>>
- Parameters:
c
- aClass
; must not benull
- Returns:
- a
MethodHandles.Lookup
; nevernull
- See Also:
-