Class Generator

    • Constructor Detail

      • Generator

        public Generator​(ClassLoader loader)
        Parameters:
        loader - ClassLoader owning generated classes
    • Method Detail

      • getPackageName

        protected abstract String getPackageName()
        Returns:
        the name of the package of the generated class. Can be null.
      • getGeneratedClassName

        public abstract String getGeneratedClassName()
        Returns:
        name of the generated class or interface
      • defineClassBody

        protected abstract void defineClassBody()
        Calls Wrapper methods to configure the class definition. The Wrapper uses ThreadLocal internally, so you should always call Wrapper._clear() in finally block after generation to avoid leakages.
      • getPackageName

        public static String getPackageName​(String fullClassName)
        Returns:
        the package name or null.
      • getBaseName

        public static String getBaseName​(String fullClassName)
        Returns:
        simple class name (including wrapper class and dollar sign if it is internal class)
      • removeRedundantMethods

        protected Method[] removeRedundantMethods​(Method[] methods)
        Remove duplicates from method array.

        Duplicates will arise if a class/intf and super-class/intf define methods with the same signature. Potentially the throws clauses of the methods may be different (note Java requires that the superclass/intf method have a superset of the exceptions in the derived method).

        Parameters:
        methods -
        Returns:
        methods which can be generated in an interface