Class ClientProxyFactory<T>

  • All Implemented Interfaces:
    PrivilegedAction<T>

    public class ClientProxyFactory<T>
    extends ProxyFactory<T>
    Proxy factory that generates client proxies, it uses optimizations that are not valid for other proxy types.
    Author:
    Stuart Douglas, Marius Bogoevici
    • Constructor Detail

      • ClientProxyFactory

        public ClientProxyFactory​(String contextId,
                                  Class<?> proxiedBeanType,
                                  Set<? extends Type> typeClosure,
                                  jakarta.enterprise.inject.spi.Bean<?> bean)
    • Method Detail

      • create

        public T create​(BeanInstance beanInstance)
        Description copied from class: ProxyFactory
        Method to create a new proxy that wraps the bean instance.
        Overrides:
        create in class ProxyFactory<T>
        Parameters:
        beanInstance - the bean instance
        Returns:
        a new proxy object
      • addAdditionalInterfaces

        protected void addAdditionalInterfaces​(Set<Class<?>> interfaces)
        Description copied from class: ProxyFactory
        Sub classes may override to specify additional interfaces the proxy should implement
        Overrides:
        addAdditionalInterfaces in class ProxyFactory<T>
      • addMethods

        protected void addMethods​(org.jboss.classfilewriter.ClassFile proxyClassType,
                                  org.jboss.classfilewriter.ClassMethod staticConstructor)
        Overrides:
        addMethods in class ProxyFactory<T>
      • addSerializationSupport

        protected void addSerializationSupport​(org.jboss.classfilewriter.ClassFile proxyClassType)
        Description copied from class: ProxyFactory
        Adds special serialization code. By default this is a nop
        Overrides:
        addSerializationSupport in class ProxyFactory<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:
        createForwardingMethodBody in class ProxyFactory<T>
      • generateHashCodeMethod

        protected void generateHashCodeMethod​(org.jboss.classfilewriter.ClassFile proxyClassType)
        Client proxies use the following hashCode: MyProxyName.class.hashCode()
        Overrides:
        generateHashCodeMethod in class ProxyFactory<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:
        generateEqualsMethod in class ProxyFactory<T>
        Parameters:
        proxyClassType - The class file
      • getProxyNameSuffix

        protected String getProxyNameSuffix()
        Description copied from class: ProxyFactory
        Returns a suffix to append to the name of the proxy class. The name already consists of _$$_Weld, to which the suffix is added. This allows the creation of different types of proxies for the same class.
        Overrides:
        getProxyNameSuffix in class ProxyFactory<T>
        Returns:
        a name suffix