net.sf.cglib.proxy
Class InterfaceMaker
- ClassGenerator
public class InterfaceMaker
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.
$Id: InterfaceMaker.java,v 1.3 2004/09/18 21:22:22 herbyderby Exp $
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.
|
void | generateClass(ClassVisitor v)
|
getAttemptLoad , getClassLoader , getCurrent , getNamingPolicy , getStrategy , getUseCache , setAttemptLoad , setClassLoader , setNamingPolicy , setStrategy , setUseCache |
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.
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 (e.g. getClass
, equals
, hashCode
).
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.
method
- the method to add to the interface
add
public void add(Signature sig,
Type[] exceptions)
Add a method signature to the interface.
sig
- the method signature to add to the interfaceexceptions
- an array of exception types to declare for the method
create
public Class create()
Create an interface using the current set of method signatures.
Copyright (c) 2001 - Apache Software Foundation