Package org.jboss.weld.bean.proxy
Interface ProxyInstantiator
-
- All Superinterfaces:
org.jboss.weld.bootstrap.api.Service
- All Known Implementing Classes:
DefaultProxyInstantiator
public interface ProxyInstantiator extends org.jboss.weld.bootstrap.api.Service
Implementations of this interface are capable of creating instances of a given proxy class. This can either be done simply by callingClass.newInstance()
or using more advanced mechanism (e.g. sun.misc.Unsafe)- Author:
- Jozef Hartinger
- See Also:
DefaultProxyInstantiator
,UnsafeProxyInstantiator
,ReflectionFactoryProxyInstantiator
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ProxyInstantiator.Factory
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
isUsingConstructor()
Indicates whether this instantiator calls proxy class' no-arg constructor or whether it uses an alternative mechanism to obtain a proxy class instance.<T> T
newInstance(Class<T> clazz)
Create a new instance of a proxy class.<T> UnproxyableResolutionException
validateNoargConstructor(Constructor<T> constructor, Class<?> clazz, jakarta.enterprise.inject.spi.Bean<?> declaringBean)
Validate, whether the given constructor is sufficient for a class to be proxyable.
-
-
-
Method Detail
-
newInstance
<T> T newInstance(Class<T> clazz) throws InstantiationException, IllegalAccessException
Create a new instance of a proxy class. This method needs to be run from a privileged context.- Type Parameters:
T
- the proxy class- Parameters:
clazz
- the class- Returns:
- an instance of a proxy class
- Throws:
InstantiationException
IllegalAccessException
-
validateNoargConstructor
<T> UnproxyableResolutionException validateNoargConstructor(Constructor<T> constructor, Class<?> clazz, jakarta.enterprise.inject.spi.Bean<?> declaringBean) throws UnproxyableResolutionException
Validate, whether the given constructor is sufficient for a class to be proxyable.- Parameters:
constructor
- the given constructorclazz
- the given classdeclaringBean
- the declaring bean- Returns:
- an
UnproxyableResolutionException
if the given class is not proxyable due to the given constructor, null otherwise - Throws:
UnproxyableResolutionException
-
isUsingConstructor
boolean isUsingConstructor()
Indicates whether this instantiator calls proxy class' no-arg constructor or whether it uses an alternative mechanism to obtain a proxy class instance.- Returns:
- true if this implementation uses proxy class' no-arg constructor for creating new instances, false otherwise
-
-