Package org.jboss.weld.bean.proxy
Class DefaultProxyInstantiator
java.lang.Object
org.jboss.weld.bean.proxy.DefaultProxyInstantiator
- All Implemented Interfaces:
ProxyInstantiator,org.jboss.weld.bootstrap.api.Service
Default
ProxyInstantiator implementation that uses proxy class' no-arg constructor to create a new instance.- Author:
- Jozef Hartinger
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jboss.weld.bean.proxy.ProxyInstantiator
ProxyInstantiator.Factory -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()booleanIndicates whether this instantiator calls proxy class' no-arg constructor or whether it uses an alternative mechanism to obtain a proxy class instance.<T> TnewInstance(Class<T> clazz) Create a new instance of a proxy class.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.
-
Field Details
-
INSTANCE
-
-
Method Details
-
newInstance
public <T> T newInstance(Class<T> clazz) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException Description copied from interface:ProxyInstantiatorCreate a new instance of a proxy class. This method needs to be run from a privileged context.- Specified by:
newInstancein interfaceProxyInstantiator- Type Parameters:
T- the proxy class- Parameters:
clazz- the class- Returns:
- an instance of a proxy class
- Throws:
InstantiationExceptionIllegalAccessExceptionNoSuchMethodExceptionInvocationTargetException
-
validateNoargConstructor
public <T> UnproxyableResolutionException validateNoargConstructor(Constructor<T> constructor, Class<?> clazz, jakarta.enterprise.inject.spi.Bean<?> declaringBean) throws UnproxyableResolutionException Description copied from interface:ProxyInstantiatorValidate, whether the given constructor is sufficient for a class to be proxyable.- Specified by:
validateNoargConstructorin interfaceProxyInstantiator- Parameters:
constructor- the given constructorclazz- the given classdeclaringBean- the declaring bean- Returns:
- an
UnproxyableResolutionExceptionif the given class is not proxyable due to the given constructor, null otherwise - Throws:
UnproxyableResolutionException
-
isUsingConstructor
public boolean isUsingConstructor()Description copied from interface:ProxyInstantiatorIndicates whether this instantiator calls proxy class' no-arg constructor or whether it uses an alternative mechanism to obtain a proxy class instance.- Specified by:
isUsingConstructorin interfaceProxyInstantiator- Returns:
- true if this implementation uses proxy class' no-arg constructor for creating new instances, false otherwise
-
cleanup
public void cleanup()- Specified by:
cleanupin interfaceorg.jboss.weld.bootstrap.api.Service
-