Top Description Fields Constructors Methods
org.springframework.cglib.proxy

public Class InterfaceMaker

extends AbstractClassGenerator
Class Inheritance
Annotations
@SuppressWarnings:rawtypes, unchecked
Imports
java.lang.reflect.Method, java.util.HashMap, .Iterator, .Map, org.springframework.asm.ClassVisitor, .Type, org.springframework.cglib.core.AbstractClassGenerator, .ClassEmitter, .Constants, .ReflectUtils, .Signature

Generates new interfaces at runtime. By passing a generated interface to the Enhancer's list of interfaces to implement, you can make your enhanced classes handle an arbitrary set of method signatures.
Author
Chris Nokleberg
Version
$Id: InterfaceMaker.java,v 1.4 2006/03/05 02:43:19 herbyderby Exp $

Field Summary

Modifier and TypeField and Description
private Map<K, V>
private static final AbstractClassGenerator.Source

Constructor Summary

AccessConstructor and Description
public
InterfaceMaker()

Create a new InterfaceMaker.

Method Summary

Modifier and TypeMethod and Description
public void
add(Signature
the method signature to add to the interface
sig
,
Type[]
an array of exception types to declare for the method
exceptions
)

Add a method signature to the interface.

public void
add(Method
the method to add to the interface
method
)

Add a method signature to the interface.

public void
add(Class<T>
the class containing the methods to add to the interface
clazz
)

Add all the public methods in the specified class.

public Class<T>
create()

Create an interface using the current set of method signatures.

protected Object
public void
protected ClassLoader
protected Object
Inherited from org.springframework.cglib.core.AbstractClassGenerator:
creategenerategetAttemptLoadgetClassLoadergetClassNamegetCurrentgetNamingPolicygetProtectionDomaingetStrategygetUseCachesetAttemptLoadsetClassLoadersetContextClasssetNamePrefixsetNamingPolicysetStrategysetUseCacheunwrapCachedValuewrapCachedClass

Field Detail

signaturesback to summary
private Map<K, V> signatures
SOURCEback to summary
private static final AbstractClassGenerator.Source SOURCE

Constructor Detail

InterfaceMakerback to summary
public InterfaceMaker()

Create a new InterfaceMaker. A new InterfaceMaker object should be used for each generated interface, and should not be shared across threads.

Method Detail

addback to summary
public void add(Signature sig, Type[] exceptions)

Add a method signature to the interface.

Parameters
sig:Signature

the method signature to add to the interface

exceptions:Type[]

an array of exception types to declare for the method

addback to summary
public void add(Method method)

Add a method signature to the interface. The method modifiers are ignored, since interface methods are by definition abstract and public.

Parameters
method:Method

the method to add to the interface

addback to summary
public void add(Class<T> clazz)

Add all the public methods in the specified class. Methods from superclasses are included, except for methods declared in the base Object class (e.g. getClass, equals, hashCode).

Parameters
clazz:Class<T>

the class containing the methods to add to the interface

createback to summary
public Class<T> create()

Create an interface using the current set of method signatures.

firstInstanceback to summary
protected Object firstInstance(Class<T> type)

Implements abstract org.springframework.cglib.core.AbstractClassGenerator.firstInstance.

Annotations
@Override
generateClassback to summary
public void generateClass(ClassVisitor v) throws Exception

Implements org.springframework.cglib.core.ClassGenerator.generateClass.

Annotations
@Override
getDefaultClassLoaderback to summary
protected ClassLoader getDefaultClassLoader()

Implements abstract org.springframework.cglib.core.AbstractClassGenerator.getDefaultClassLoader.

Annotations
@Override
nextInstanceback to summary
protected Object nextInstance(Object instance)

Implements abstract org.springframework.cglib.core.AbstractClassGenerator.nextInstance.

Annotations
@Override