Class ReflectiveClientProxier
java.lang.Object
org.microbean.proxy.AbstractProxier<ProxySpecification>
org.microbean.proxy.AbstractReflectiveProxier<ProxySpecification>
org.microbean.reference.ReflectiveClientProxier
- All Implemented Interfaces:
ClientProxier
public class ReflectiveClientProxier
extends AbstractReflectiveProxier<ProxySpecification>
implements ClientProxier
An
AbstractReflectiveProxier
implementation that uses java.lang.reflect.Proxy
machinery.- Author:
- Laird Nelson
-
Constructor Summary
ConstructorsConstructorDescriptionReflectiveClientProxier
(Domain domain) Creates a newReflectiveClientProxier
. -
Method Summary
Modifier and TypeMethodDescription<R> R
clientProxy
(Id id, Supplier<? extends R> instanceSupplier) protected final <R> Proxy
<R> proxy
(ProxySpecification ps, Class<?>[] interfaces, Supplier<? extends R> instanceSupplier) Methods inherited from class org.microbean.proxy.AbstractReflectiveProxier
equalsMethod, executableElement, hashCodeMethod, parameterizable, proxy, type, types
Methods inherited from class org.microbean.proxy.AbstractProxier
classLoader, domain
-
Constructor Details
-
ReflectiveClientProxier
Creates a newReflectiveClientProxier
.- Parameters:
domain
- aDomain
; must not benull
- Throws:
NullPointerException
- ifdomain
isnull
-
-
Method Details
-
clientProxy
Description copied from interface:ClientProxier
Returns a contextual reference which is also aProxy
, given aSupplier
of contextual instances of the appropriate type.Implementations of this method may return
null
.- Specified by:
clientProxy
in interfaceClientProxier
- Type Parameters:
R
- the type of the contextual reference- Parameters:
id
- anId
qualifying the contextual instance that will be proxied; must not benull
instanceSupplier
- aSupplier
of contextual instances of the appropriate type; must not benull
- 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) - Specified by:
proxy
in classAbstractReflectiveProxier<ProxySpecification>
- Type Parameters:
R
- the contextual instance type- Parameters:
ps
- an appropriate proxy specification; must not benull
interfaces
- the interfaces to implement; every element is guaranteed to be an interfaceinstanceSupplier
- aSupplier
of contextual instances; must not benull
; 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 isnull
-