Interface ProxyFactory

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <T> InterceptorBuilder<T> buildInterceptor​(Class<T> proxyClass)
      Creates a new builder for constructing an interceptor or "protection" proxy.
      Object createProxy​(Class<?>[] proxyInterfaces, ProxyHandler<?> handler)
      Creates a proxy that implements multiple interfaces where invocations on that proxy are passed to a single invoke method on the ProxyHandler.
      <T> T createProxy​(Class<T> proxyClass, javax.inject.Provider<T> provider)
      Creates a "virtual" proxy where method invocations on the proxy are delegated to the provided instance.
      <T> T createProxy​(Class<T> proxyClass, ProxyHandler<T> handler)
      Creates a proxy where method invocations on the proxy are passed to a single invoke method on the ProxyHandler.
      <T> T createProxy​(Class<T> proxyClass, T target, Class<? extends Annotation> marker, org.aopalliance.intercept.MethodInterceptor... interceptors)
      Creates a "protection" proxy where method invocations on the proxy are intercepted by the chain of MethodInterceptors before (optionally) being invoked on the target.
    • Method Detail

      • createProxy

        <T> T createProxy​(Class<T> proxyClass,
                          javax.inject.Provider<T> provider)
                   throws GenerationException
        Creates a "virtual" proxy where method invocations on the proxy are delegated to the provided instance.
        Type Parameters:
        T - The proxy type
        Parameters:
        proxyClass - The proxied class
        provider - The provider of the proxied object
        Returns:
        The proxy
        Throws:
        GenerationException - If an error occurs creating the proxy
      • createProxy

        <T> T createProxy​(Class<T> proxyClass,
                          ProxyHandler<T> handler)
                   throws GenerationException
        Creates a proxy where method invocations on the proxy are passed to a single invoke method on the ProxyHandler.
        Type Parameters:
        T - The proxy type
        Parameters:
        proxyClass - The proxied interface class
        handler - The handler for the method invocation
        Returns:
        The proxy
        Throws:
        GenerationException - If an error occurs creating the proxy
      • createProxy

        <T> T createProxy​(Class<T> proxyClass,
                          T target,
                          Class<? extends Annotation> marker,
                          org.aopalliance.intercept.MethodInterceptor... interceptors)
                   throws GenerationException
        Creates a "protection" proxy where method invocations on the proxy are intercepted by the chain of MethodInterceptors before (optionally) being invoked on the target.
        Type Parameters:
        T - The proxy type
        Parameters:
        proxyClass - The proxy class
        target - The target of the invocation
        marker - The annotation that marks intercepted methods
        interceptors - One or more method interceptors, which are called in order
        Returns:
        The proxy
        Throws:
        GenerationException - If an error occurs creating the proxy
      • buildInterceptor

        <T> InterceptorBuilder<T> buildInterceptor​(Class<T> proxyClass)
        Creates a new builder for constructing an interceptor or "protection" proxy. The builder allows fine-grained customization of how the target's methods are intercepted.
        Type Parameters:
        T - The proxy type
        Parameters:
        proxyClass - The class of the proxy (and target)
        Returns:
        The builder