Class PlasticProxyFactoryImpl

    • Method Detail

      • getClassLoader

        public java.lang.ClassLoader getClassLoader()
        Description copied from interface: PlasticProxyFactory
        Returns the class loader used when creating new classes, this is a child class loader of another class loader (usually, the thread's context class loader).
        Specified by:
        getClassLoader in interface PlasticProxyFactory
      • createProxy

        public <T> ClassInstantiator<T> createProxy​(java.lang.Class<T> interfaceType,
                                                    java.lang.Class<? extends T> implementationType,
                                                    PlasticClassTransformer callback)
        Description copied from interface: PlasticProxyFactory
        Same as createProxy(interfacetype, implementationType, callback, true)
        Specified by:
        createProxy in interface PlasticProxyFactory
        Parameters:
        interfaceType - interface implemented by proxy
        implementationType - a class that implements the interfaceType. It can be null.
        callback - configures the proxy
        Returns:
        instantiator that can be used to create an instance of the proxy class
      • createProxy

        public <T> ClassInstantiator<T> createProxy​(java.lang.Class<T> interfaceType,
                                                    java.lang.Class<? extends T> implementationType,
                                                    PlasticClassTransformer callback,
                                                    boolean introduceInterface)
        Description copied from interface: PlasticProxyFactory
        Creates a proxy object that implements the indicated interface and indicated service implementation type, then invokes the callback to further configure the proxy.
        Specified by:
        createProxy in interface PlasticProxyFactory
        Parameters:
        interfaceType - interface implemented by proxy
        implementationType - a class that implements the interfaceType. It can be null.
        callback - configures the proxy
        Returns:
        instantiator that can be used to create an instance of the proxy class
      • createProxy

        public <T> ClassInstantiator<T> createProxy​(java.lang.Class<T> interfaceType,
                                                    PlasticClassTransformer callback)
        Description copied from interface: PlasticProxyFactory
        Creates a proxy object that implements the indicated interface, then invokes the callback to further configure the proxy.
        Specified by:
        createProxy in interface PlasticProxyFactory
        Parameters:
        interfaceType - interface implemented by proxy
        callback - configures the proxy
        Returns:
        instantiator that can be used to create an instance of the proxy class
      • createProxyTransformation

        public <T> PlasticClassTransformation<T> createProxyTransformation​(java.lang.Class<T> interfaceType,
                                                                           java.lang.Class<? extends T> implementationType)
        Description copied from interface: PlasticProxyFactory
        Creates the underlying PlasticClassTransformation for an interface proxy with a given implementation class. This should only be used in the cases where encapsulating the PlasticClass construction into a callback is not feasible (which is the case for some of the older APIs inside Tapestry IoC).
        Specified by:
        createProxyTransformation in interface PlasticProxyFactory
        Parameters:
        interfaceType - class proxy will extend from
        implementationType - a class that implements the interfaceType. It can be null.
        Returns:
        transformation from which an instantiator may be created
      • createProxy

        public <T> T createProxy​(java.lang.Class<T> interfaceType,
                                 ObjectCreator<T> creator,
                                 java.lang.String description)
        Description copied from interface: PlasticProxyFactory
        Creates a proxy instance that delegates all methods through a corresponding ObjectCreator. Each method invocation on the proxy will route through ObjectCreator.createObject() (the creator implementation may decide to cache the return value as appropriate).
        Specified by:
        createProxy in interface PlasticProxyFactory
        Type Parameters:
        T - type of proxy
        Parameters:
        interfaceType - interface class for proxy
        creator - object responsible for creating the real object
        description - the toString() of the proxy
        Returns:
        proxy instance
      • createProxy

        public <T> T createProxy​(java.lang.Class<T> interfaceType,
                                 java.lang.Class<? extends T> implementationType,
                                 ObjectCreator<T> creator,
                                 java.lang.String description)
        Description copied from interface: PlasticProxyFactory
        Creates a proxy instance that delegates all methods through a corresponding ObjectCreator. Each method invocation on the proxy will route through ObjectCreator.createObject() (the creator implementation may decide to cache the return value as appropriate).
        Specified by:
        createProxy in interface PlasticProxyFactory
        Type Parameters:
        T - type of proxy
        Parameters:
        interfaceType - interface class for proxy
        implementationType - class that implements the interface type. It may be null
        creator - object responsible for creating the real object
        description - the toString() of the proxy
        Returns:
        proxy instance
      • getMethodLocation

        public Location getMethodLocation​(java.lang.reflect.Method method)
        Description copied from interface: PlasticProxyFactory
        Converts a method to a Location, which includes information about the source file name and line number.
        Specified by:
        getMethodLocation in interface PlasticProxyFactory
        Parameters:
        method - to look up
        Returns:
        the location (identifying the method and possibly, the line number within the method)
      • getConstructorLocation

        public Location getConstructorLocation​(java.lang.reflect.Constructor constructor)
        Description copied from interface: PlasticProxyFactory
        Return a string representation for the constructor (including class and parameters) and (if available) file name and line number.
        Specified by:
        getConstructorLocation in interface PlasticProxyFactory
        Returns:
        the location (identifying the constructor and possibly, the line number within the method)
      • clearCache

        public void clearCache()
        Description copied from interface: PlasticProxyFactory
        Clears any cached information stored by the proxy factory; this is useful in Tapestry development mode when a class loader may have been discarded (because the proxy factory may indirectly keep references to classes loaded by the old class loader).
        Specified by:
        clearCache in interface PlasticProxyFactory
      • getMemberLocation

        public Location getMemberLocation​(java.lang.reflect.Member member,
                                          java.lang.String methodName,
                                          java.lang.String memberTypeDesc,
                                          ObjectCreator<java.lang.String> textDescriptionCreator)