Package org.springframework.cglib.proxy

# Class InterfaceMaker

java.lang.Object
org.springframework.cglib.core.AbstractClassGenerator
org.springframework.cglib.proxy.InterfaceMaker

All Implemented Interfaces:
  `ClassGenerator`

public class InterfaceMaker extends AbstractClassGenerator
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

## Nested Class Summary

## Nested classes/interfaces inherited from class org.springframework.cglib.core.AbstractClassGenerator

`AbstractClassGenerator.ClassLoaderData, AbstractClassGenerator.Source`

## Constructor Summary

Constructors
Constructor
Description
`InterfaceMaker()`
Create a new `InterfaceMaker`.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(Class clazz)`
Add all the public methods in the specified class.
`void`
`add(Method method)`
Add a method signature to the interface.
`void`
`add(Signature sig, Type[] exceptions)`
Add a method signature to the interface.
`Class`
`create()`
Create an interface using the current set of method signatures.
`protected Object`
`firstInstance(Class type)`
`void`
`generateClass(ClassVisitor v)`
`protected ClassLoader`
`getDefaultClassLoader()`
`protected Object`
`nextInstance(Object instance)`

### Methods inherited from class org.springframework.cglib.core.AbstractClassGenerator

`create, generate, getAttemptLoad, getClassLoader, getClassName, getCurrent, getNamingPolicy, getProtectionDomain, getStrategy, getUseCache, setAttemptLoad, setClassLoader, setContextClass, setNamePrefix, setNamingPolicy, setStrategy, setUseCache, unwrapCachedValue, wrapCachedClass`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### InterfaceMaker

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 Details

### add

public void add(Signature sig, Type[] exceptions)
Add a method signature to the interface.

Parameters:
  `sig` - the method signature to add to the interface
  `exceptions` - an array of exception types to declare for the method

### add

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` - the method to add to the interface

### add

public void add(Class clazz)
Add all the public methods in the specified class. Methods from superclasses are included, except for methods declared in the base Object class (for example, `getClass`, `equals`, `hashCode`).

Parameters:
  `clazz` - the class containing the methods to add to the interface

### create

public Class create()
Create an interface using the current set of method signatures.

### getDefaultClassLoader

protected ClassLoader getDefaultClassLoader()

Specified by:
  `getDefaultClassLoader` in class `AbstractClassGenerator`

### firstInstance

protected Object firstInstance(Class type)

Specified by:
  `firstInstance` in class `AbstractClassGenerator`

### nextInstance

protected Object nextInstance(Object instance)

Specified by:
  `nextInstance` in class `AbstractClassGenerator`

### generateClass

public void generateClass(ClassVisitor v) throws Exception

Throws:
  `Exception`