Package org.jboss.weld.bean.proxy
Class ClientProxyFactory<T>
java.lang.Object
org.jboss.weld.bean.proxy.ProxyFactory<T>
org.jboss.weld.bean.proxy.ClientProxyFactory<T>
Proxy factory that generates client proxies, it uses optimizations that
are not valid for other proxy types.
- Author:
- Stuart Douglas, Marius Bogoevici
-
Field Summary
Fields inherited from class org.jboss.weld.bean.proxy.ProxyFactory
CONSTRUCTED_FLAG_NAME, DEFAULT_METHOD_RESOLVER, DEFAULT_PROXY_PACKAGE, INIT_METHOD_NAME, INVOKE_METHOD_NAME, LBEAN_IDENTIFIER, LJAVA_LANG_BYTE, LJAVA_LANG_CLASS, LJAVA_LANG_OBJECT, LJAVA_LANG_REFLECT_METHOD, LJAVA_LANG_STRING, LJAVA_LANG_THREAD_LOCAL, METHOD_HANDLER_FIELD_NAME, PROXY_SUFFIX, WELD_PROXY_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionClientProxyFactory(String contextId, Class<?> proxiedBeanType, Set<? extends Type> typeClosure, jakarta.enterprise.inject.spi.Bean<?> bean) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddAdditionalInterfaces(Set<Class<?>> interfaces) Sub classes may override to specify additional interfaces the proxy should implementprotected voidaddFields(org.jboss.classfilewriter.ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) protected voidaddMethods(org.jboss.classfilewriter.ClassFile proxyClassType, org.jboss.classfilewriter.ClassMethod staticConstructor) protected voidaddSerializationSupport(org.jboss.classfilewriter.ClassFile proxyClassType) Adds special serialization code.create(BeanInstance beanInstance) Method to create a new proxy that wraps the bean instance.protected voidcreateForwardingMethodBody(org.jboss.classfilewriter.ClassMethod classMethod, MethodInformation methodInfo, org.jboss.classfilewriter.ClassMethod staticConstructor) Calls methodHandler.invoke with a null method parameter in order to get the underlying instance.protected voidgenerateEqualsMethod(org.jboss.classfilewriter.ClassFile proxyClassType) Client proxies are equal to other client proxies for the same bean.protected voidgenerateHashCodeMethod(org.jboss.classfilewriter.ClassFile proxyClassType) Client proxies use the following hashCode:MyProxyName.class.hashCode()protected Class<? extends MethodHandler>protected StringReturns a suffix to append to the name of the proxy class.protected booleanisMethodAccepted(Method method, Class<?> proxySuperclass) Methods inherited from class org.jboss.weld.bean.proxy.ProxyFactory
addConstructedGuardToMethodBody, addConstructedGuardToMethodBody, addConstructors, addInterface, addInterfacesFromTypeClosure, addMethodsFromClass, addSpecialMethods, createInterceptorBody, createSpecialMethodBody, generateGetMethodHandlerBody, generateSetMethodHandlerBody, getAdditionalInterfaces, getBaseProxyName, getBean, getBeanType, getContextId, getMethodHandlerField, getProxiedBeanType, getProxyClass, getProxySuperclass, instantiateProxy, invokeMethodHandler, isUsingProxyInstantiator, setBeanInstance, toClass
-
Constructor Details
-
ClientProxyFactory
-
-
Method Details
-
create
Description copied from class:ProxyFactoryMethod to create a new proxy that wraps the bean instance.- Overrides:
createin classProxyFactory<T>- Parameters:
beanInstance- the bean instance- Returns:
- a new proxy object
-
addAdditionalInterfaces
Description copied from class:ProxyFactorySub classes may override to specify additional interfaces the proxy should implement- Overrides:
addAdditionalInterfacesin classProxyFactory<T>
-
addMethods
protected void addMethods(org.jboss.classfilewriter.ClassFile proxyClassType, org.jboss.classfilewriter.ClassMethod staticConstructor) - Overrides:
addMethodsin classProxyFactory<T>
-
addFields
protected void addFields(org.jboss.classfilewriter.ClassFile proxyClassType, List<DeferredBytecode> initialValueBytecode) - Overrides:
addFieldsin classProxyFactory<T>
-
getMethodHandlerType
- Overrides:
getMethodHandlerTypein classProxyFactory<T>
-
addSerializationSupport
protected void addSerializationSupport(org.jboss.classfilewriter.ClassFile proxyClassType) Description copied from class:ProxyFactoryAdds special serialization code. By default this is a nop- Overrides:
addSerializationSupportin classProxyFactory<T>- Parameters:
proxyClassType- the Javassist class for the proxy class
-
createForwardingMethodBody
protected void createForwardingMethodBody(org.jboss.classfilewriter.ClassMethod classMethod, MethodInformation methodInfo, org.jboss.classfilewriter.ClassMethod staticConstructor) Calls methodHandler.invoke with a null method parameter in order to get the underlying instance. The invocation is then forwarded to this instance with generated bytecode.- Overrides:
createForwardingMethodBodyin classProxyFactory<T>
-
generateHashCodeMethod
protected void generateHashCodeMethod(org.jboss.classfilewriter.ClassFile proxyClassType) Client proxies use the following hashCode:MyProxyName.class.hashCode()- Overrides:
generateHashCodeMethodin classProxyFactory<T>
-
generateEqualsMethod
protected void generateEqualsMethod(org.jboss.classfilewriter.ClassFile proxyClassType) Client proxies are equal to other client proxies for the same bean. The corresponding java code:return other instanceof MyProxyClassType.class- Overrides:
generateEqualsMethodin classProxyFactory<T>- Parameters:
proxyClassType- The class file
-
getProxyNameSuffix
Description copied from class:ProxyFactoryReturns a suffix to append to the name of the proxy class. The name already consists of <class-name>_$$_Weld, to which the suffix is added. This allows the creation of different types of proxies for the same class.- Overrides:
getProxyNameSuffixin classProxyFactory<T>- Returns:
- a name suffix
-
isMethodAccepted
- Overrides:
isMethodAcceptedin classProxyFactory<T>
-