类 InterfaceMaker

所有已实现的接口:
ClassGenerator

public class InterfaceMaker extends AbstractClassGenerator<Object>
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.
作者:
Chris Nokleberg, TODAY
  • 字段详细资料

  • 构造器详细资料

    • 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(MethodSignature sig, Type[] exceptions)
      Add a method signature to the interface.
      参数:
      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.
      参数:
      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 (e.g. getClass, equals, hashCode).
      参数:
      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()
      指定者:
      getDefaultClassLoader 在类中 AbstractClassGenerator<Object>
    • firstInstance

      protected Object firstInstance(Class<Object> type) throws Exception
      指定者:
      firstInstance 在类中 AbstractClassGenerator<Object>
      抛出:
      Exception
    • nextInstance

      protected Object nextInstance(Object instance)
      指定者:
      nextInstance 在类中 AbstractClassGenerator<Object>
    • generateClass

      public void generateClass(ClassVisitor v) throws Exception
      抛出:
      Exception