类 AbstractClassGenerator<T>
java.lang.Object
cn.taketoday.bytecode.core.AbstractClassGenerator<T>
- 所有已实现的接口:
ClassGenerator
- 直接已知子类:
BeanCopier.Generator,BeanGenerator,BulkBean.Generator,ConstructorDelegate.Generator,Enhancer,ImmutableBean.Generator,InterfaceMaker,KeyFactory.Generator,MethodAccess.Generator,MethodDelegate.Generator,Mixin.Generator,MulticastDelegate.Generator,ParallelSorter.Generator,StringSwitcher.Generator
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.- 作者:
- TODAY
2019-09-04 20:12
-
嵌套类概要
嵌套类 -
构造器概要
构造器限定符构造器说明protectedAbstractClassGenerator(Class<?> source) protectedAbstractClassGenerator(String source) -
方法概要
修饰符和类型方法说明protected Objectprotected abstract ObjectfirstInstance(Class<T> type) protected Classprotected final Stringstatic AbstractClassGeneratorUsed internally by CGLIB.protected abstract ClassLoaderprotected ProtectionDomainReturns the protection domain to use when defining the class.booleanbooleanprotected abstract ObjectnextInstance(Object instance) voidsetAttemptLoad(boolean attemptLoad) If set, CGLIB will attempt to load classes from the specifiedClassLoaderbefore generating them.setClassLoader(ClassLoader classLoader) Set theClassLoaderin which the class will be generated.voidsetDefineClassStrategy(DefineClassStrategy defineClassStrategy) protected AbstractClassGeneratorsetNamePrefix(String namePrefix) setNamingPolicy(NamingPolicy namingPolicy) Override the default naming policy.voidsetNeighbor(Class<?> neighbor) setStrategy(GeneratorStrategy strategy) Set the strategy to use to create the bytecode from this generator.setUseCache(boolean useCache) Whether use and update the static cache of generated classes for a class with the same properties.protected ObjectunwrapCachedValue(T cached) protected TwrapCachedClass(Class klass) 从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 cn.taketoday.bytecode.core.ClassGenerator
generateClass
-
构造器详细资料
-
AbstractClassGenerator
-
AbstractClassGenerator
-
-
方法详细资料
-
wrapCachedClass
-
unwrapCachedValue
-
setNamePrefix
-
getClassName
-
setClassLoader
Set theClassLoaderin which the class will be generated. Concrete subclasses ofAbstractClassGenerator(such asEnhancer) will try to choose an appropriate default if this is unset.Classes are cached per-
ClassLoaderusing aWeakHashMap, 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 default
-
setNamingPolicy
Override the default naming policy.- 参数:
namingPolicy- the custom policy, or null to use the default- 另请参阅:
-
getNamingPolicy
-
setDefineClassStrategy
-
getDefineClassStrategy
-
setUseCache
Whether use and update the static cache of generated classes for a class with the same properties. Default istrue. -
getUseCache
public boolean getUseCache()- 另请参阅:
-
setAttemptLoad
public void setAttemptLoad(boolean attemptLoad) If set, CGLIB will attempt to load classes from the specifiedClassLoaderbefore generating them. Because generated class names are not guaranteed to be unique, the default isfalse. -
isAttemptLoad
public boolean isAttemptLoad() -
setStrategy
Set the strategy to use to create the bytecode from this generator. By default an instance of is used. -
getStrategy
-
getCurrent
Used internally by CGLIB. Returns theAbstractClassGeneratorthat is being used to generate a class in the current thread. -
getClassLoader
-
getDefaultClassLoader
-
getProtectionDomain
Returns the protection domain to use when defining the class.Default implementation returns
nullfor using a default protection domain. Sub-classes may override to use a more specific protection domain.- 返回:
- the protection domain (
nullfor using a default)
-
create
-
generate
-
setNeighbor
-
firstInstance
- 抛出:
Exception
-
nextInstance
- 抛出:
Exception
-