|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.cglib.core.AbstractClassGenerator
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
|
Constructor Summary | |
protected |
AbstractClassGenerator(AbstractClassGenerator.Source source)
|
Method Summary | |
protected java.lang.Object |
create(java.lang.Object key)
|
protected abstract java.lang.Object |
firstInstance(java.lang.Class type)
|
protected java.lang.ClassLoader |
getClassLoader()
|
protected java.lang.String |
getClassName()
|
protected abstract java.lang.ClassLoader |
getDefaultClassLoader()
|
protected abstract java.lang.Object |
nextInstance(java.lang.Object instance)
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Set the ClassLoader in which the class will be generated.
|
protected void |
setNamePrefix(java.lang.String namePrefix)
|
void |
setNamingPolicy(NamingPolicy namingPolicy)
Override the default naming policy. |
void |
setStrategy(GeneratorStrategy strategy)
Set the strategy to use to create the bytecode from this generator. |
void |
setUseCache(boolean useCache)
Whether use and update the static cache of generated classes for a class with the same properties. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.cglib.core.ClassGenerator |
generateClass |
Constructor Detail |
protected AbstractClassGenerator(AbstractClassGenerator.Source source)
Method Detail |
protected void setNamePrefix(java.lang.String namePrefix)
protected final java.lang.String getClassName()
public void setClassLoader(java.lang.ClassLoader classLoader)
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.
classLoader
- the loader to generate the new class with, or null to use the defaultpublic void setNamingPolicy(NamingPolicy namingPolicy)
namingPolicy
- the custom policy, or null to use the defaultDefaultNamingPolicy
public void setUseCache(boolean useCache)
true
.
public void setStrategy(GeneratorStrategy strategy)
DefaultGeneratorStrategy
is used.
protected java.lang.ClassLoader getClassLoader()
protected abstract java.lang.ClassLoader getDefaultClassLoader()
protected java.lang.Object create(java.lang.Object key)
protected abstract java.lang.Object firstInstance(java.lang.Class type) throws java.lang.Exception
java.lang.Exception
protected abstract java.lang.Object nextInstance(java.lang.Object instance) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |