Contents
Class AbstractToolkitProxier<PS extends ProxySpecification,T>
java.lang.Object
org.microbean.proxy.AbstractProxier<PS>
org.microbean.proxy.AbstractToolkitProxier<PS,T>
- Type Parameters:
PS
- theProxySpecification
typeT
- the toolkit representation of an unloadedClass
public abstract non-sealed class AbstractToolkitProxier<PS extends ProxySpecification,T>
extends AbstractProxier<PS>
An
AbstractProxier
built using some kind of toolkit, such as Byte Buddy and the like.- Author:
- Laird Nelson
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractToolkitProxier
(Domain domain, MethodHandles.Lookup lookup) Creates a newAbstractToolkitProxier
. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract T
Creates a generated class definition from the information present in the suppliedProxySpecification
, and returns it for eventual supplying to an inovcation of theproxyClass(Object, ClassLoader)
method.protected MethodHandles.Lookup
Returns aMethodHandles.Lookup
suitable for the suppliedClass
.protected final Class
<?> proxyClass
(PS ps) Loads and returns the proxy class corresponding to the supplied proxy specification, generating it first if necessary.protected abstract Class
<?> proxyClass
(T t, ClassLoader cl) Called by theproxyClass(ProxySpecification)
method, converts the supplied class definition into aClass
, using the suppliedClassLoader
, and returns it.Methods inherited from class org.microbean.proxy.AbstractProxier
classLoader, domain, proxy
-
Constructor Details
-
AbstractToolkitProxier
Creates a newAbstractToolkitProxier
.- Parameters:
domain
- aDomain
; must not benull
lookup
- aMethodHandles.Lookup
; must not benull
- Throws:
NullPointerException
- if any argument isnull
- See Also:
-
-
Method Details
-
generate
Creates a generated class definition from the information present in the suppliedProxySpecification
, and returns it for eventual supplying to an inovcation of theproxyClass(Object, ClassLoader)
method.- Parameters:
ps
- aProxySpecification
; must not benull
- Returns:
- a non-
null
generated class definition - Throws:
NullPointerException
- ifps
isnull
Throwable
- if creation of the generated class definition fails- See Also:
-
lookup
Returns aMethodHandles.Lookup
suitable for the suppliedClass
.- Parameters:
c
- aClass
; must not benull
- Returns:
- a
MethodHandles.Lookup
suitable for the suppliedClass
8 - See Also:
-
proxyClass
Loads and returns the proxy class corresponding to the supplied proxy specification, generating it first if necessary.- Parameters:
ps
- a proxy specification; must not benull
- Returns:
- a non-
null
Class
that is guaranteed to be assignable toProxy.class
- Throws:
ClassNotFoundException
- if the class could not be found- See Also:
-
proxyClass
Called by theproxyClass(ProxySpecification)
method, converts the supplied class definition into aClass
, using the suppliedClassLoader
, and returns it.Overrides of this method must not call the
proxyClass(ProxySpecification)
method or undefined behavior may result.- Parameters:
t
- a class definition; must not benull
cl
- aClassLoader
; must not benull
- Returns:
- a non-
null
Class
- Throws:
NullPointerException
- if any argument isnull
ClassNotFoundException
- if an invocation ofClassLoader.loadClass(String)
fails- See Also:
-