Package net.sf.cglib.beans
Class BeanGenerator
- java.lang.Object
-
- net.sf.cglib.core.AbstractClassGenerator
-
- net.sf.cglib.beans.BeanGenerator
-
- All Implemented Interfaces:
ClassGenerator
public class BeanGenerator extends AbstractClassGenerator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceBeanGenerator.BeanGeneratorKey-
Nested classes/interfaces inherited from class net.sf.cglib.core.AbstractClassGenerator
AbstractClassGenerator.ClassLoaderData, AbstractClassGenerator.Source
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclassOnlyprivate static BeanGenerator.BeanGeneratorKeyKEY_FACTORYprivate java.util.Mappropsprivate static AbstractClassGenerator.SourceSOURCEprivate java.lang.Classsuperclass
-
Constructor Summary
Constructors Constructor Description BeanGenerator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddProperties(BeanGenerator gen, java.beans.PropertyDescriptor[] descriptors)static voidaddProperties(BeanGenerator gen, java.lang.Class type)static voidaddProperties(BeanGenerator gen, java.util.Map props)voidaddProperty(java.lang.String name, java.lang.Class type)java.lang.Objectcreate()java.lang.ObjectcreateClass()private java.lang.ObjectcreateHelper()protected java.lang.ObjectfirstInstance(java.lang.Class type)voidgenerateClass(org.objectweb.asm.ClassVisitor v)protected java.lang.ClassLoadergetDefaultClassLoader()protected java.security.ProtectionDomaingetProtectionDomain()Returns the protection domain to use when defining the class.protected java.lang.ObjectnextInstance(java.lang.Object instance)voidsetSuperclass(java.lang.Class superclass)Set the class which the generated class will extend.-
Methods inherited from class net.sf.cglib.core.AbstractClassGenerator
create, generate, getAttemptLoad, getClassLoader, getClassName, getCurrent, getNamingPolicy, getStrategy, getUseCache, setAttemptLoad, setClassLoader, setNamePrefix, setNamingPolicy, setStrategy, setUseCache, unwrapCachedValue, wrapCachedClass
-
-
-
-
Field Detail
-
SOURCE
private static final AbstractClassGenerator.Source SOURCE
-
KEY_FACTORY
private static final BeanGenerator.BeanGeneratorKey KEY_FACTORY
-
superclass
private java.lang.Class superclass
-
props
private java.util.Map props
-
classOnly
private boolean classOnly
-
-
Method Detail
-
setSuperclass
public void setSuperclass(java.lang.Class superclass)
Set the class which the generated class will extend. The class must not be declared as final, and must have a non-private no-argument constructor.- Parameters:
superclass- class to extend, or null to extend Object
-
addProperty
public void addProperty(java.lang.String name, java.lang.Class type)
-
getDefaultClassLoader
protected java.lang.ClassLoader getDefaultClassLoader()
- Specified by:
getDefaultClassLoaderin classAbstractClassGenerator
-
getProtectionDomain
protected java.security.ProtectionDomain getProtectionDomain()
Description copied from class:AbstractClassGeneratorReturns 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.- Overrides:
getProtectionDomainin classAbstractClassGenerator- Returns:
- the protection domain (
nullfor using a default)
-
create
public java.lang.Object create()
-
createClass
public java.lang.Object createClass()
-
createHelper
private java.lang.Object createHelper()
-
generateClass
public void generateClass(org.objectweb.asm.ClassVisitor v) throws java.lang.Exception- Throws:
java.lang.Exception
-
firstInstance
protected java.lang.Object firstInstance(java.lang.Class type)
- Specified by:
firstInstancein classAbstractClassGenerator
-
nextInstance
protected java.lang.Object nextInstance(java.lang.Object instance)
- Specified by:
nextInstancein classAbstractClassGenerator
-
addProperties
public static void addProperties(BeanGenerator gen, java.util.Map props)
-
addProperties
public static void addProperties(BeanGenerator gen, java.lang.Class type)
-
addProperties
public static void addProperties(BeanGenerator gen, java.beans.PropertyDescriptor[] descriptors)
-
-