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 ClassFabImpl

    java.lang.Object
      org.apache.tapestry5.ioc.internal.services.AbstractFab
          org.apache.tapestry5.ioc.internal.services.ClassFabImpl

All Implemented Interfaces:
  ClassFab

    public class ClassFabImpl

extends AbstractFab
implements ClassFab

Implementation of `ClassFab`. Hides, as much as possible, the underlying library (Javassist).

Field Summary

Fields inherited from class org.apache.tapestry5.ioc.internal.services.AbstractFab
`lock`

Constructor Summary
`ClassFabImpl(CtClassSource source, javassist.CtClass ctClass, org.slf4j.Logger logger)`

Method Summary
`void` | `addConstructor(java.lang.Class[] parameterTypes, java.lang.Class[] exceptions, java.lang.String body)` Adds a constructor to the class.
`void` | `addField(java.lang.String name, java.lang.Class type)` Adds a new field with the given name and type.
`void` | `addField(java.lang.String name, int modifiers, java.lang.Class type)` Adds a new field with the provided modifiers.
`void` | `addMethod(int modifiers, MethodSignature ms, java.lang.String body)` Adds a method.
`void` | `addNoOpMethod(MethodSignature signature)` Adds a public no-op method.
`void` | `addToString(java.lang.String toString)` Adds an implementation of toString, as a method that returns a fixed string.
`void` | `copyClassAnnotationsFromDelegate(java.lang.Class delegateClass)` Copies annotations from delegate class to the fabricated class.
`void` | `copyMethodAnnotationsFromDelegate(java.lang.Class serviceInterface, java.lang.Class delegateClass)` Copies method annotations from delegate class to the methods of the fabricated class.
`void` | `proxyMethodsToDelegate(java.lang.Class serviceInterface, java.lang.String delegateExpression, java.lang.String toString)` Makes the fabricated class implement the provided service interface.
`java.lang.String` | `toString()` Returns a representation of the fabricated class, including inheritance, fields, constructors, methods and method bodies.

Methods inherited from class org.apache.tapestry5.ioc.internal.services.AbstractFab
`addInterface, createClass, getCtClass, getLogger, getSource, toCtClass, toCtClasses`

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

Methods inherited from interface org.apache.tapestry5.ioc.services.ClassFab
`addInterface, createClass`

Constructor Detail

### ClassFabImpl

    public ClassFabImpl(CtClassSource source,
                        javassist.CtClass ctClass,
                        org.slf4j.Logger logger)

Method Detail

### toString

    public java.lang.String toString()

  Returns a representation of the fabricated class, including inheritance, fields, constructors, methods and method bodies.

  Overrides:
    `toString` in class `java.lang.Object`

### addField

    public void addField(java.lang.String name,
                         java.lang.Class type)

  Description copied from interface: `ClassFab`
  Adds a new field with the given name and type. The field is added as a private field.

  Specified by:
    `addField` in interface `ClassFab`

### addField

    public void addField(java.lang.String name,
                         int modifiers,
                         java.lang.Class type)

  Description copied from interface: `ClassFab`
  Adds a new field with the provided modifiers.

  Specified by:
    `addField` in interface `ClassFab`

### proxyMethodsToDelegate

    public void proxyMethodsToDelegate(java.lang.Class serviceInterface,
                                       java.lang.String delegateExpression,
                                       java.lang.String toString)

  Description copied from interface: `ClassFab`
  Makes the fabricated class implement the provided service interface. The interface will be added, and all methods in the interface will be delegate wrappers. If toString() is not part of the delegate interface, then an implementation will be supplied that returns the provided string. This method is used when creating objects that proxy their behavior to some other object.

  Specified by:
    `proxyMethodsToDelegate` in interface `ClassFab`
  Parameters:
    `serviceInterface` - the interface to implement
    `delegateExpression` - the expression used to find the delegate on which methods should be invoked. Typically a field name, such as "_delegate", or a method to invoke, such as "_service()".
    `toString` - fixed value to be returned as the description of the resultant object

### addToString

    public void addToString(java.lang.String toString)

  Description copied from interface: `ClassFab`
  Adds an implementation of toString, as a method that returns a fixed string.

  Specified by:
    `addToString` in interface `ClassFab`

### addMethod

    public void addMethod(int modifiers,
                          MethodSignature ms,
                          java.lang.String body)

  Description copied from interface: `ClassFab`
  Adds a method. The method is a public instance method.

  Specified by:
    `addMethod` in interface `ClassFab`
  Parameters:
    `modifiers` - Modifiers for the method (see `Modifier`).
    `ms` - defines the name, return type, parameters and exceptions thrown
    `body` - The body of the method.

### addNoOpMethod

    public void addNoOpMethod(MethodSignature signature)

  Description copied from interface: `ClassFab`
  Adds a public no-op method. The method will return null, false, or zero as per the return type (if not void).

  Specified by:
    `addNoOpMethod` in interface `ClassFab`

### addConstructor

    public void addConstructor(java.lang.Class[] parameterTypes,
                               java.lang.Class[] exceptions,
                               java.lang.String body)

  Description copied from interface: `ClassFab`
  Adds a constructor to the class. The constructor will be public.

  Specified by:
    `addConstructor` in interface `ClassFab`
  Parameters:
    `parameterTypes` - the type of each parameter, or null if the constructor takes no parameters.
    `exceptions` - the type of each exception, or null if the constructor throws no exceptions.
    `body` - The body of the constructor.

### copyClassAnnotationsFromDelegate

    public void copyClassAnnotationsFromDelegate(java.lang.Class delegateClass)

  Description copied from interface: `ClassFab`
  Copies annotations from delegate class to the fabricated class.

  Specified by:
    `copyClassAnnotationsFromDelegate` in interface `ClassFab`
  Parameters:
    `delegateClass` - class of the delegate

### copyMethodAnnotationsFromDelegate

    public void copyMethodAnnotationsFromDelegate(java.lang.Class serviceInterface,
                                                  java.lang.Class delegateClass)

  Description copied from interface: `ClassFab`
  Copies method annotations from delegate class to the methods of the fabricated class.

  Specified by:
    `copyMethodAnnotationsFromDelegate` in interface `ClassFab`
  Parameters:
    `serviceInterface` - service interface
    `delegateClass` - class of the delegate

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.