Class AbstractReflectiveProxier<PS extends ProxySpecification>
java.lang.Object
org.microbean.proxy.AbstractProxier<PS>
org.microbean.proxy.AbstractReflectiveProxier<PS>
- Type Parameters:
PS
- theProxySpecification
type
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 Type
s and Executable
s to their TypeMirror
and ExecutableElement
counterparts.
- Author:
- Laird Nelson
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractReflectiveProxier
(Domain domain) Creates a newAbstractReflectiveProxier
implementation. -
Method Summary
Modifier and TypeMethodDescriptionprotected final boolean
protected final ExecutableElement
Returns anExecutableElement
corresponding to the suppliedExecutable
.protected final boolean
protected final Parameterizable
Returns aParameterizable
corresponding to the suppliedGenericDeclaration
.protected abstract <R> Proxy
<R> final <R> Proxy
<R> protected final TypeMirror
Returns theTypeMirror
corresponding to the suppliedType
.protected final TypeMirror[]
Returns an array ofTypeMirror
s whose elements correspond to the elements in the suppliedType
array.Methods inherited from class org.microbean.proxy.AbstractProxier
classLoader, domain
-
Constructor Details
-
AbstractReflectiveProxier
Creates a newAbstractReflectiveProxier
implementation.- Parameters:
domain
- aDomain
; must not benull
- Throws:
NullPointerException
- ifdomain
isnull
-
-
Method Details
-
equalsMethod
- Parameters:
m
- aMethod
; must not benull
- Returns:
true
if the suppliedMethod
is thejava.lang.Object#equals(java.lang.Object)
method- Throws:
NullPointerException
- ifm
isnull
-
executableElement
Returns anExecutableElement
corresponding to the suppliedExecutable
.- Parameters:
e
- anExecutable
; must not benull
- Returns:
- an
ExecutableElement
corresponding to the suppliedExecutable
; nevernull
- Throws:
NullPointerException
- ife
isnull
IllegalArgumentException
- if somehowe
is neither aConstructor
nor aMethod
-
hashCodeMethod
- Parameters:
m
- aMethod
; must not benull
- Returns:
true
if the suppliedMethod
is thejava.lang.Object#hashCode()
method- Throws:
NullPointerException
- ifm
isnull
-
parameterizable
Returns aParameterizable
corresponding to the suppliedGenericDeclaration
.- Parameters:
gd
- aGenericDeclaration
; must not benull
- Returns:
- a
Parameterizable
corresponding to the suppliedGenericDeclaration
; nevernull
- Throws:
NullPointerException
- ifgd
isnull
IllegalArgumentException
- ifgd
is neither aClass
nor anExecutable
-
proxy
- Specified by:
proxy
in classAbstractProxier<PS extends ProxySpecification>
- Type Parameters:
R
- the contextual instance type- Parameters:
ps
- an appropriate proxy specification; must not benull
instanceSupplier
- 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
IllegalArgumentException
- 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 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
-
type
Returns theTypeMirror
corresponding to the suppliedType
.- Parameters:
t
- aType
; must not benull
- Returns:
- the
TypeMirror
corresponding to the suppliedType
; nevernull
- Throws:
NullPointerException
- ift
isnull
IllegalArgumentException
- ift
is not aClass
,GenericArrayType
,ParameterizedType
,TypeVariable
orWildcardType
-
types
Returns an array ofTypeMirror
s whose elements correspond to the elements in the suppliedType
array.- Parameters:
ts
- an array ofType
s; must not benull
- Returns:
- an array of
TypeMirror
s whose elements correspond to the elements in the suppliedType
array; nevernull
- Throws:
NullPointerException
- ifts
isnull
or containsnull
elementsIllegalArgumentException
- if any element ofts
is deemed illegal by thetype(Type)
method- See Also:
-