Class AbstractReflectiveProxier<PS extends ProxySpecification>
java.lang.Object
org.microbean.proxy.AbstractProxier<PS>
org.microbean.proxy.AbstractReflectiveProxier<PS>
- Type Parameters:
PS- theProxySpecificationtype
public abstract non-sealed class AbstractReflectiveProxier<PS extends ProxySpecification>
extends AbstractProxier<PS>
An
AbstractProxier that helps subclasses create proxies using the java.lang.reflect.Proxy machinery present in the Java Development Kit.
This class also contains various protected utility methods that help with converting reflective Types and Executables to their TypeMirror and ExecutableElement counterparts.
- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractReflectiveProxier(Domain domain) Creates a newAbstractReflectiveProxierimplementation. -
Method Summary
Modifier and TypeMethodDescriptionprotected final booleanA convenience method that returnstrueif the suppliedMethodis thejava.lang.Object#equals(java.lang.Object)method.protected final booleanA convenience method that returnstrueif the suppliedMethodis thejava.lang.Object#hashCode()method.protected abstract <R> Proxy<R> final <R> Proxy<R> Methods inherited from class AbstractProxier
classLoader, domain
-
Constructor Details
-
AbstractReflectiveProxier
Creates a newAbstractReflectiveProxierimplementation.- Parameters:
domain- aDomain; must not benull- Throws:
NullPointerException- ifdomainisnull
-
-
Method Details
-
equalsMethod
A convenience method that returnstrueif the suppliedMethodis thejava.lang.Object#equals(java.lang.Object)method.- Parameters:
m- aMethod; must not benull- Returns:
trueif the suppliedMethodis thejava.lang.Object#equals(java.lang.Object)method- Throws:
NullPointerException- ifmisnull
-
hashCodeMethod
A convenience method that returnstrueif the suppliedMethodis thejava.lang.Object#hashCode()method.- Parameters:
m- aMethod; must not benull- Returns:
trueif the suppliedMethodis thejava.lang.Object#hashCode()method- Throws:
NullPointerException- ifmisnull
-
proxy
- Specified by:
proxyin classAbstractProxier<PS extends ProxySpecification>- Type Parameters:
R- the contextual instance type- Parameters:
ps- an appropriate proxy specification; must not benullinstanceSupplier- 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 isnullIllegalArgumentException- if the superclass is notjava.lang.Object(only interfaces may be proxied reflectively)- See Also:
-
proxy
protected abstract <R> Proxy<R> proxy(PS ps, Class<?>[] interfaces, Supplier<? extends R> instanceSupplier) - 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
-