Package com.microstrategy.web.beans
Class AbstractLocalBeanFactory
- java.lang.Object
- 
- com.microstrategy.web.beans.AbstractLocalBeanFactory
 
- 
- All Implemented Interfaces:
- LocalBeanFactory
 - Direct Known Subclasses:
- AdminBeanFactory,- AppBeanFactory,- WebBeanFactory
 
 public abstract class AbstractLocalBeanFactory extends java.lang.Object implements LocalBeanFactory Default implementation of theLocalBeanFactoryinterface that resolves bean type names to bean classes by appending "Impl" to the bean type name. A given subclass should implementgetBeanPackage()to specify the package associated with the factory. If the factory supports creating non-public bean implementation classes,createBeanInstance(java.lang.Class)can be overridden to create the actual bean instances. OverridegetBeanClassName(java.lang.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.- Since:
- MicroStrategy Web 9.0.0
 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedAbstractLocalBeanFactory()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleancanCreateBean(java.lang.String beanName)Check whether this factory can create a bean with a given type name.protected WebComponentcreateBeanInstance(java.lang.Class beanClass)Create an instance ofbeanClass.protected java.lang.StringgetBeanClassName(java.lang.String beanName)Resolve a bean type name to a fully qualified class name (ex: "ReportBean" --> "com.microstrategy.web.beans.ReportBeanImpl").protected abstract java.lang.StringgetBeanPackage()Returns the full name of the package associated with this factory (ex: "com.microstrategy.web.beans").WebComponentnewBean(java.lang.String beanName)Create a bean based on the bean type name.
 
- 
- 
- 
Method Detail- 
newBeanpublic WebComponent newBean(java.lang.String beanName) throws java.lang.IllegalArgumentException, BeanNotFoundException, MSTRUncheckedException 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 bygetBeanPackage(). This method will callgetBeanClassName(java.lang.String)to resolvebeanNameto a class name, andcreateBeanInstance(java.lang.Class)to create the bean instance.- Specified by:
- newBeanin interface- LocalBeanFactory
- Parameters:
- beanName- The type name of the desired bean (ex: "ReportBean").
- Returns:
- A new WebComponentinstance that corresponds tobeanName.
- Throws:
- java.lang.IllegalArgumentException- If- beanNameis null or empty.
- BeanNotFoundException- If- beanNamecould not be resolved to a class.
- MSTRUncheckedException- If an error occurred in the process of instantiating the bean instance.
 
 - 
getBeanClassNameprotected java.lang.String getBeanClassName(java.lang.String beanName) Resolve a bean type name to a fully qualified class name (ex: "ReportBean" --> "com.microstrategy.web.beans.ReportBeanImpl"). This implementation simply returnsgetBeanPackage() + "." + beanName + "Impl". Override this method to change the way bean type names are resolved to class names.- Parameters:
- beanName- Bean type name to resolve.
- Returns:
- Fully qualified bean class name corresponding to beanName.
 
 - 
createBeanInstanceprotected WebComponent createBeanInstance(java.lang.Class beanClass) throws java.lang.IllegalAccessException, java.lang.InstantiationException Create an instance ofbeanClass. This implementation simply callsbeanClass.newInstance(). Override this method in a derived class to create instances of non-public bean classes. Throws the same exceptions asClass.newInstance().- Parameters:
- beanClass- The class of the desired bean.
- Returns:
- An instance of the desired bean class.
- Throws:
- java.lang.IllegalAccessException
- java.lang.InstantiationException
 
 - 
getBeanPackageprotected abstract java.lang.String getBeanPackage() Returns the full name of the package associated with this factory (ex: "com.microstrategy.web.beans").- Returns:
- The name of the package associated with this factory.
 
 - 
canCreateBeanpublic boolean canCreateBean(java.lang.String beanName) 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 callingnewBean(java.lang.String)with that bean type name will result in aBeanNotFoundException.- Specified by:
- canCreateBeanin interface- LocalBeanFactory
- Parameters:
- beanName- The type name of the bean to check.
- Returns:
- true if this factory can create a bean for beanName; false otherwise.
 
 
- 
 
-