public class BeanConfig extends Object
Constructor and Description |
---|
BeanConfig(BeanConfig config)
Copies a bean configuration.
|
BeanConfig(String className,
Properties properties)
Creates a bean configuration.
|
Modifier and Type | Method and Description |
---|---|
ClassLoader |
getClassLoader()
Returns the current
ClassLoader used to instantiate objects
in the newInstance(Class) method. |
String |
getClassName()
Returns the class name of the configured bean.
|
static ClassLoader |
getDefaultClassLoader()
Returns the current
ClassLoader used for new instances of
this class as the loader used to instantiate objects in the
newInstance(Class) method. |
Properties |
getParameters()
Returns the initial properties of the configured bean.
|
<T> T |
newInstance(Class<T> klass)
Creates a new instance of the configured bean class.
|
void |
setClassLoader(ClassLoader classLoader)
Sets the
ClassLoader used to instantiate objects in the
newInstance(Class) method. |
void |
setConnectionFactory(ConnectionFactory connectionFactory) |
static void |
setDefaultClassLoader(ClassLoader classLoader)
Sets the
ClassLoader used for new instances of this class as
the loader to instantiate objects in the newInstance(Class) method. |
void |
setInstanceFactory(BeanFactory instanceFactory) |
protected void |
setValidate(boolean validate)
Allows subclasses to control whether the configured bean property
names should be validated.
|
public BeanConfig(String className, Properties properties)
className
- class name of the beanproperties
- initial properties of the beanpublic BeanConfig(BeanConfig config)
config
- the configuration to be copiedprotected void setValidate(boolean validate)
validate
- flag to validate the configured property namespublic void setConnectionFactory(ConnectionFactory connectionFactory)
connectionFactory
- the ConnectionFactory
to inject (if possible) in the
newInstance(Class)
methodpublic void setInstanceFactory(BeanFactory instanceFactory)
instanceFactory
- the BeanFactory
to use to create bean instancepublic String getClassName()
public Properties getParameters()
public <T> T newInstance(Class<T> klass) throws ConfigurationException
ConfigurationException
- on bean configuration errorspublic ClassLoader getClassLoader()
ClassLoader
used to instantiate objects
in the newInstance(Class)
method.public void setClassLoader(ClassLoader classLoader)
ClassLoader
used to instantiate objects in the
newInstance(Class)
method.classLoader
- The class loader to set on this instance. If this is
null
the system class loader will be used, which may
lead to unexpected class loading failures.getClassLoader()
,
getDefaultClassLoader()
,
setDefaultClassLoader(ClassLoader)
public static ClassLoader getDefaultClassLoader()
ClassLoader
used for new instances of
this class as the loader used to instantiate objects in the
newInstance(Class)
method.public static void setDefaultClassLoader(ClassLoader classLoader)
ClassLoader
used for new instances of this class as
the loader to instantiate objects in the newInstance(Class)
method.classLoader
- The class loader to set as the default class loader.
If this is null
the system class loader will be used,
which may lead to unexpected class loading failures.getClassLoader()
,
setClassLoader(ClassLoader)
,
getDefaultClassLoader()
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.