Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.ioc.internal.services
Class ClassFactoryImpl

    java.lang.Object
      org.apache.tapestry5.ioc.internal.services.ClassFactoryImpl

All Implemented Interfaces:
  ClassFactory

    public class ClassFactoryImpl

extends java.lang.Object
implements ClassFactory

Implementation of `ClassFactory`.

Constructor Summary
`ClassFactoryImpl()`
`ClassFactoryImpl(java.lang.ClassLoader classLoader)`
`ClassFactoryImpl(java.lang.ClassLoader classLoader, ClassFactoryClassPool pool, CtClassSource classSource, org.slf4j.Logger logger)`
`ClassFactoryImpl(java.lang.ClassLoader classLoader, ClassFactoryClassPool pool, org.slf4j.Logger logger)` Special constructor used when the class pool is provided externally.
`ClassFactoryImpl(java.lang.ClassLoader classLoader, org.slf4j.Logger log)` Main constructor where a specific class loader and log is provided.

Method Summary
`
`<T> T`
` | `createProxy(java.lang.Class<T> proxyInterface, java.lang.Class<? extends T> delegateClass, ObjectCreator delegateCreator, java.lang.String description)` Creates a proxy for an interface.
`
`<T> T`
` | `createProxy(java.lang.Class<T> proxyInterface, ObjectCreator delegateCreator, java.lang.String description)` Creates a proxy for an interface.
`java.lang.ClassLoader` | `getClassLoader()` 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(java.lang.reflect.Constructor constructor)` Return a string representation for the constructor (including class and parameters) and (if available) file name and line number.
`int` | `getCreatedClassCount()` Returns the number of classes (and interfaces) actually created.
`Location` | `getMethodLocation(java.lang.reflect.Method method)` Converts a method to a `Location`, which includes information about the source file name and line number.
`java.lang.Class` | `importClass(java.lang.Class clazz)` Imports the class to make it referenceable within the factory.
`ClassFab` | `newClass(java.lang.Class serviceInterface)` Simplified version of `ClassFactory.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(java.lang.String name, java.lang.Class superClass)` Creates a `ClassFab` object for the given name; the new class is a subclass of the indicated class.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassFactoryImpl

    public ClassFactoryImpl(java.lang.ClassLoader classLoader)

### ClassFactoryImpl

    public ClassFactoryImpl()

### ClassFactoryImpl

    public ClassFactoryImpl(java.lang.ClassLoader classLoader,
                            org.slf4j.Logger log)

  Main constructor where a specific class loader and log is provided.

### ClassFactoryImpl

    public ClassFactoryImpl(java.lang.ClassLoader classLoader,
                            ClassFactoryClassPool pool,
                            org.slf4j.Logger logger)

  Special constructor used when the class pool is provided externally.

### ClassFactoryImpl

    public ClassFactoryImpl(java.lang.ClassLoader classLoader,
                            ClassFactoryClassPool pool,
                            CtClassSource classSource,
                            org.slf4j.Logger logger)

Method Detail

### newClass

    public ClassFab newClass(java.lang.Class serviceInterface)

  Description copied from interface: `ClassFactory`
  Simplified version of `ClassFactory.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.

  Specified by:
    `newClass` in interface `ClassFactory`

### newClass

    public ClassFab newClass(java.lang.String name,
                             java.lang.Class superClass)

  Description copied from interface: `ClassFactory`
  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.

  Specified by:
    `newClass` in interface `ClassFactory`
  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

    public java.lang.Class importClass(java.lang.Class clazz)

  Description copied from interface: `ClassFactory`
  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.

  Specified by:
    `importClass` in interface `ClassFactory`
  Returns:
    a referenceable super-class

### getCreatedClassCount

    public int getCreatedClassCount()

  Description copied from interface: `ClassFactory`
  Returns the number of classes (and interfaces) actually created.

  Specified by:
    `getCreatedClassCount` in interface `ClassFactory`

### getClassLoader

    public java.lang.ClassLoader getClassLoader()

  Description copied from interface: `ClassFactory`
  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).

  Specified by:
    `getClassLoader` in interface `ClassFactory`

### getMethodLocation

    public Location getMethodLocation(java.lang.reflect.Method method)

  Description copied from interface: `ClassFactory`
  Converts a method to a `Location`, which includes information about the source file name and line number.

  Specified by:
    `getMethodLocation` in interface `ClassFactory`
  Parameters:
    `method` - to look up
  Returns:
    the location, or null if the necessary information is not available

### getConstructorLocation

    public Location getConstructorLocation(java.lang.reflect.Constructor constructor)

  Description copied from interface: `ClassFactory`
  Return a string representation for the constructor (including class and parameters) and (if available) file name and line number.

  Specified by:
    `getConstructorLocation` in interface `ClassFactory`

### createProxy

    public <T> T createProxy(java.lang.Class<T> proxyInterface,
                             ObjectCreator delegateCreator,
                             java.lang.String description)

  Description copied from interface: `ClassFactory`
  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).

  Specified by:
    `createProxy` in interface `ClassFactory`
  Type Parameters:
    `T` - type of proxy
  Parameters:
    `proxyInterface` - proxy interface class
    `delegateCreator` - creates the delegate
    `description` - used for the toString() method

### createProxy

    public <T> T createProxy(java.lang.Class<T> proxyInterface,
                             java.lang.Class<? extends T> delegateClass,
                             ObjectCreator delegateCreator,
                             java.lang.String description)

  Description copied from interface: `ClassFactory`
  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).

  Specified by:
    `createProxy` in interface `ClassFactory`
  Type Parameters:
    `T` - type of proxy
  Parameters:
    `proxyInterface` - proxy interface class
    `delegateClass` - delegate class
    `delegateCreator` - creates the delegate
    `description` - used for the toString() method

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.