Package net.sf.cglib.proxy

## Class InterfaceMaker

- java.lang.Object
- - net.sf.cglib.core.AbstractClassGenerator
  - - net.sf.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.

Version:
  $Id: InterfaceMaker.java,v 1.4 2006/03/05 02:43:19 herbyderby Exp $
Author:
  Chris Nokleberg

### Nested Class Summary

### Nested classes/interfaces inherited from class net.sf.cglib.core.AbstractClassGenerator

`AbstractClassGenerator.ClassLoaderData, AbstractClassGenerator.Source`

### Constructor Summary

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

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add​(java.lang.Class clazz)` Add all the public methods in the specified class.
`void` `add​(java.lang.reflect.Method method)` Add a method signature to the interface.
`void` `add​(Signature sig, org.objectweb.asm.Type[] exceptions)` Add a method signature to the interface.
`java.lang.Class` `create()` Create an interface using the current set of method signatures.
`protected java.lang.Object` `firstInstance​(java.lang.Class type)`
`void` `generateClass​(org.objectweb.asm.ClassVisitor v)`
`protected java.lang.ClassLoader` `getDefaultClassLoader()`
`protected java.lang.Object` `nextInstance​(java.lang.Object instance)`

### Methods inherited from class net.sf.cglib.core.AbstractClassGenerator

`create, generate, getAttemptLoad, getClassLoader, getClassName, getCurrent, getNamingPolicy, getProtectionDomain, getStrategy, getUseCache, setAttemptLoad, setClassLoader, 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 Detail

#### 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 Detail

#### add

    public void add​(Signature sig,
                    org.objectweb.asm.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​(java.lang.reflect.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​(java.lang.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 (e.g. `getClass`, `equals`, `hashCode`).

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

#### create

    public java.lang.Class create()

Create an interface using the current set of method signatures.

#### getDefaultClassLoader

    protected java.lang.ClassLoader getDefaultClassLoader()

Specified by:
  `getDefaultClassLoader` in class `AbstractClassGenerator`

#### firstInstance

    protected java.lang.Object firstInstance​(java.lang.Class type)

Specified by:
  `firstInstance` in class `AbstractClassGenerator`

#### nextInstance

    protected java.lang.Object nextInstance​(java.lang.Object instance)

Specified by:
  `nextInstance` in class `AbstractClassGenerator`

#### generateClass

    public void generateClass​(org.objectweb.asm.ClassVisitor v)
                       throws java.lang.Exception

Throws:
  `java.lang.Exception`