java.lang.Object | |
↳ | com.microstrategy.web.beans.AbstractLocalBeanFactory |
![]() |
Default implementation of the LocalBeanFactory
interface that
resolves bean type names to bean classes by appending "Impl" to the bean type
name. A given subclass should implement getBeanPackage()
to specify
the package associated with the factory. If the factory supports creating
non-public bean implementation classes, createBeanInstance(Class)
can be
overridden to create the actual bean instances. Override
getBeanClassName(String)
to change the way bean type names are resolved to
class names. Note that the implementation caches resolved bean class objects,
so a given bean type name is only resolved to a bean class name once.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
AbstractLocalBeanFactory() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
boolean |
canCreateBean(String beanName)
Check whether this factory can create a bean with a given type name.
| ||||||||||
WebComponent |
newBean(String beanName)
Create a bean based on the bean type name.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
WebComponent |
createBeanInstance(Class beanClass)
Create an instance of
beanClass . | ||||||||||
String |
getBeanClassName(String beanName)
Resolve a bean type name to a fully qualified class name (ex:
"ReportBean" --> "com.microstrategy.web.beans.ReportBeanImpl").
| ||||||||||
abstract String |
getBeanPackage()
Returns the full name of the package associated with this factory
(ex: "com.microstrategy.web.beans").
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Check whether this factory can create a bean with a given type name. If
this method returns false for a given bean type name, then calling
newBean(String)
with that bean type name will result in a
BeanNotFoundException
.
beanName | The type name of the bean to check. |
---|
beanName
;
false otherwise.
Create a bean based on the bean type name. This implementation will look
for a bean class named "<pkg name>.<beanName>Impl
",
where <pkg name>
is the string returned by
getBeanPackage()
. This method will call getBeanClassName(String)
to resolve beanName
to a class name, and
createBeanInstance(Class)
to create the bean instance.
beanName | The type name of the desired bean (ex: "ReportBean"). |
---|
WebComponent
instance that corresponds to
beanName
.IllegalArgumentException | If beanName is null
or empty. |
---|---|
BeanNotFoundException | If beanName could not be
resolved to a class. |
MSTRUncheckedException | If an error occurred in the process of instantiating the bean instance. |
Create an instance of beanClass
. This implementation simply
calls beanClass.newInstance()
. Override this method in a
derived class to create instances of non-public bean classes.
Throws the same exceptions as newInstance()
.
beanClass | The class of the desired bean. |
---|
IllegalAccessException | |
---|---|
InstantiationException |
Resolve a bean type name to a fully qualified class name (ex:
"ReportBean" --> "com.microstrategy.web.beans.ReportBeanImpl").
This implementation simply returns
getBeanPackage() + "." + beanName + "Impl"
. Override this
method to change the way bean type names are resolved to class names.
beanName | Bean type name to resolve. |
---|
beanName
.
Returns the full name of the package associated with this factory (ex: "com.microstrategy.web.beans").