Save This Page
Home » cglib-src-2.2 » net.sf.cglib.core » [javadoc | source]
abstract public class: AbstractClassGenerator [javadoc | source]

All Implemented Interfaces:

Direct Known Subclasses:
    Generator, BeanGenerator, Generator, Generator, Generator, Generator, Generator, Generator, Generator, Generator, Generator, InterfaceMaker, Generator, Generator, Enhancer

Abstract class for all code-generating CGLIB utilities. In addition to caching generated classes for performance, it provides hooks for customizing the ClassLoader, name of the generated class, and transformations applied before generation.
Nested Class Summary:
protected static class  AbstractClassGenerator.Source   
 protected AbstractClassGenerator(AbstractClassGenerator.Source source) 
Method from net.sf.cglib.core.AbstractClassGenerator Summary:
create,   firstInstance,   getAttemptLoad,   getClassLoader,   getClassName,   getCurrent,   getDefaultClassLoader,   getNamingPolicy,   getStrategy,   getUseCache,   nextInstance,   setAttemptLoad,   setClassLoader,   setNamePrefix,   setNamingPolicy,   setStrategy,   setUseCache
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from net.sf.cglib.core.AbstractClassGenerator Detail:
 protected Object create(Object key) 
 abstract protected Object firstInstance(Class type) throws Exception
 public boolean getAttemptLoad() 
 public ClassLoader getClassLoader() 
 protected final String getClassName() 
 public static AbstractClassGenerator getCurrent() 
    Used internally by CGLIB. Returns the AbstractClassGenerator that is being used to generate a class in the current thread.
 abstract protected ClassLoader getDefaultClassLoader()
 public NamingPolicy getNamingPolicy() 
 public GeneratorStrategy getStrategy() 
 public boolean getUseCache() 
 abstract protected Object nextInstance(Object instance) throws Exception
 public  void setAttemptLoad(boolean attemptLoad) 
    If set, CGLIB will attempt to load classes from the specified ClassLoader before generating them. Because generated class names are not guaranteed to be unique, the default is false.
 public  void setClassLoader(ClassLoader classLoader) 
    Set the ClassLoader in which the class will be generated. Concrete subclasses of AbstractClassGenerator (such as Enhancer) will try to choose an appropriate default if this is unset.

    Classes are cached per-ClassLoader using a WeakHashMap, to allow the generated classes to be removed when the associated loader is garbage collected.

 protected  void setNamePrefix(String namePrefix) 
 public  void setNamingPolicy(NamingPolicy namingPolicy) 
    Override the default naming policy.
 public  void setStrategy(GeneratorStrategy strategy) 
    Set the strategy to use to create the bytecode from this generator. By default an instance of {@see DefaultGeneratorStrategy} is used.
 public  void setUseCache(boolean useCache) 
    Whether use and update the static cache of generated classes for a class with the same properties. Default is true.