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 booleanprotected final ExecutableElementReturns anExecutableElementcorresponding to the suppliedExecutable.protected final booleanprotected final ParameterizableReturns aParameterizablecorresponding to the suppliedGenericDeclaration.protected abstract <R> Proxy<R> final <R> Proxy<R> protected final TypeMirrorReturns theTypeMirrorcorresponding to the suppliedType.protected final TypeMirror[]Returns an array ofTypeMirrors whose elements correspond to the elements in the suppliedTypearray.Methods inherited from class org.microbean.proxy.AbstractProxier
classLoader, domain
-
Constructor Details
-
AbstractReflectiveProxier
Creates a newAbstractReflectiveProxierimplementation.- Parameters:
domain- aDomain; must not benull- Throws:
NullPointerException- ifdomainisnull
-
-
Method Details
-
equalsMethod
- Parameters:
m- aMethod; must not benull- Returns:
trueif the suppliedMethodis thejava.lang.Object#equals(java.lang.Object)method- Throws:
NullPointerException- ifmisnull
-
executableElement
Returns anExecutableElementcorresponding to the suppliedExecutable.- Parameters:
e- anExecutable; must not benull- Returns:
- an
ExecutableElementcorresponding to the suppliedExecutable; nevernull - Throws:
NullPointerException- ifeisnullIllegalArgumentException- if somehoweis neither aConstructornor aMethod
-
hashCodeMethod
- Parameters:
m- aMethod; must not benull- Returns:
trueif the suppliedMethodis thejava.lang.Object#hashCode()method- Throws:
NullPointerException- ifmisnull
-
parameterizable
Returns aParameterizablecorresponding to the suppliedGenericDeclaration.- Parameters:
gd- aGenericDeclaration; must not benull- Returns:
- a
Parameterizablecorresponding to the suppliedGenericDeclaration; nevernull - Throws:
NullPointerException- ifgdisnullIllegalArgumentException- ifgdis neither aClassnor anExecutable
-
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
-
type
Returns theTypeMirrorcorresponding to the suppliedType.- Parameters:
t- aType; must not benull- Returns:
- the
TypeMirrorcorresponding to the suppliedType; nevernull - Throws:
NullPointerException- iftisnullIllegalArgumentException- iftis not aClass,GenericArrayType,ParameterizedType,TypeVariableorWildcardType
-
types
Returns an array ofTypeMirrors whose elements correspond to the elements in the suppliedTypearray.- Parameters:
ts- an array ofTypes; must not benull- Returns:
- an array of
TypeMirrors whose elements correspond to the elements in the suppliedTypearray; nevernull - Throws:
NullPointerException- iftsisnullor containsnullelementsIllegalArgumentException- if any element oftsis deemed illegal by thetype(Type)method- See Also:
-