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> RclientProxy(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, typesMethods inherited from class org.microbean.proxy.AbstractProxier
classLoader, domain
-
Constructor Details
-
ReflectiveClientProxier
Creates a newReflectiveClientProxier.- Parameters:
domain- aDomain; must not benull- Throws:
NullPointerException- ifdomainisnull
-
-
Method Details
-
clientProxy
Description copied from interface:ClientProxierReturns a contextual reference which is also aProxy, given aSupplierof contextual instances of the appropriate type.Implementations of this method may return
null.- Specified by:
clientProxyin interfaceClientProxier- Type Parameters:
R- the type of the contextual reference- Parameters:
id- anIdqualifying the contextual instance that will be proxied; must not benullinstanceSupplier- aSupplierof 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:
proxyin classAbstractReflectiveProxier<ProxySpecification>- Type Parameters:
R- the contextual instance type- Parameters:
ps- an appropriate proxy specification; must not benullinterfaces- the interfaces to implement; every element is guaranteed to be an interfaceinstanceSupplier- aSupplierof 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-
nullProxy - Throws:
NullPointerException- if any argument isnull
-