org.apache.tapestry5.ioc.services
Interface ClassFactory

All Known Implementing Classes:
ClassFactoryImpl

Deprecated. In 5.3, use PlasticProxyFactory instead

public interface ClassFactory

Service used when dynamically creating new classes.


Method Summary
<T> T
createProxy(Class<T> proxyInterface, Class<? extends T> delegateClass, ObjectCreator delegateCreator, String description)
          Deprecated. Creates a proxy for an interface.
<T> T
createProxy(Class<T> proxyInterface, ObjectCreator delegateCreator, String description)
          Deprecated. Creates a proxy for an interface.
 ClassLoader getClassLoader()
          Deprecated. Returns the class loader used when creating new classes; this is generally the same as the current thread's context class loader (except perhaps during testing).
 Location getConstructorLocation(Constructor constructor)
          Deprecated. Return a string representation for the constructor (including class and parameters) and (if available) file name and line number.
 int getCreatedClassCount()
          Deprecated. Returns the number of classes (and interfaces) actually created.
 Location getMethodLocation(Method method)
          Deprecated. Converts a method to a Location, which includes information about the source file name and line number.
 Class importClass(Class clazz)
          Deprecated. Imports the class to make it referenceable within the factory.
 ClassFab newClass(Class serviceInterface)
          Deprecated. Simplified version of newClass(String, Class) that generates a name based on the service interface name, extends from java.lang.Object, and automatically adds the serviceInterface to the returned ClassFab.
 ClassFab newClass(String name, Class superClass)
          Deprecated. Creates a ClassFab object for the given name; the new class is a subclass of the indicated class.
 

Method Detail

newClass

ClassFab newClass(Class serviceInterface)
Deprecated. 
Simplified version of newClass(String, Class) that generates a name based on the service interface name, extends from java.lang.Object, and automatically adds the serviceInterface to the returned ClassFab. This is the most common use when creating the kinds of proxies used throughout Tapestry IoC.

Parameters:
serviceInterface -

newClass

ClassFab newClass(String name,
                  Class superClass)
Deprecated. 
Creates a ClassFab object for the given name; the new class is a subclass of the indicated class. The new class is always public and concrete.

Parameters:
name - the full qualified name of the class to create (note that it is common to place created classes in the default package)
superClass - the parent class, which is often java.lang.Object

importClass

Class importClass(Class clazz)
Deprecated. 
Imports the class to make it referenceable within the factory. The class loader for the class is added to the class path. The class itself is returned, if its bytecode is available. If not, a search up the inhertance occurs until a proper class (that can be referenced in generated bytecode) is found. This is necessary to handle cases where a class is generated at runtime, outside of the class factory, and bytecode is not available for it.

Parameters:
clazz -
Returns:
a referenceable super-class

getCreatedClassCount

int getCreatedClassCount()
Deprecated. 
Returns the number of classes (and interfaces) actually created.


getClassLoader

ClassLoader getClassLoader()
Deprecated. 
Returns the class loader used when creating new classes; this is generally the same as the current thread's context class loader (except perhaps during testing).


getMethodLocation

Location getMethodLocation(Method method)
Deprecated. 
Converts a method to a Location, which includes information about the source file name and line number.

Parameters:
method - to look up
Returns:
the location, or null if the necessary information is not available

getConstructorLocation

Location getConstructorLocation(Constructor constructor)
Deprecated. 
Return a string representation for the constructor (including class and parameters) and (if available) file name and line number.


createProxy

<T> T createProxy(Class<T> proxyInterface,
                  ObjectCreator delegateCreator,
                  String description)
Deprecated. 
Creates a proxy for an interface. All methods of the interface are delegated through the object returned from the ObjectCreator (which is accessed on each method invocation, so it is responsible for caching of the true delegate). The description will be used for the toString() method (unless toString() is part of the proxy interface).

Type Parameters:
T - type of proxy
Parameters:
proxyInterface - proxy interface class
delegateCreator - creates the delegate
description - used for the toString() method
Since:
5.2.0

createProxy

<T> T createProxy(Class<T> proxyInterface,
                  Class<? extends T> delegateClass,
                  ObjectCreator delegateCreator,
                  String description)
Deprecated. 
Creates a proxy for an interface. All methods of the interface are delegated through the object returned from the ObjectCreator (which is accessed on each method invocation, so it is responsible for caching of the true delegate). The description will be used for the toString() method (unless toString() is part of the proxy interface).

Type Parameters:
T - type of proxy
Parameters:
proxyInterface - proxy interface class
delegateClass - delegate class
delegateCreator - creates the delegate
description - used for the toString() method
Since:
5.2.0


Copyright © 2003-2012 The Apache Software Foundation.