Package com.zfabrik.springframework
Class ComponentsQueryFactoryBean
java.lang.Object
com.zfabrik.springframework.ComponentsQueryFactoryBean
public class ComponentsQueryFactoryBean
extends Object
implements org.springframework.beans.factory.FactoryBean<Map<String,Object>>
Factory bean abstracting a z2 components query with a property set as filter condition
and returning a key value map with a predefined key property.
The purpose of the key property is to provide an identifying information to the application. If none set, the component name will be used as key.
The map is backed by an IComponentsRepository.findComponents(com.zfabrik.util.expression.X)
query result that
is cached internally. It is absolutely immutable by the consumer and may change during software updates.
Use like this:
<bean id="someBeans" class="com.zfabrik.springframework.ComponentsQueryFactoryBean"> <property name="className" value="sample.ITheBeanInterface"/> <property name="filter"> <props> <prop key="sample.iAmABean">true</prop> </props> </property> </bean>In this case, all components that have a name value pair
sample.iAmABean=true
in their component properties
would be queried and looked up as extensions of the class sample.ITheBeanInterface
.-
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprovides the actual collection instanceClass<?>
ReturnsCollection.class
boolean
The result bean is indeed a singletonvoid
setClassName(String className)
Set the type of the single query result item.void
Filter properties.void
setIdPropertyName(String idPropName)
Id property.
-
Field Details
-
clz
-
filter
-
idPropName
-
map
-
-
Constructor Details
-
ComponentsQueryFactoryBean
public ComponentsQueryFactoryBean()
-
-
Method Details
-
setClassName
Set the type of the single query result item. The map provided by this factory bean will use this type as value type.- Parameters:
className
-- Throws:
Exception
-
setFilter
Filter properties. All filter name value pairs will be combined into a boolean filter expression consisting of an AND conjunction.- Parameters:
props
-
-
setIdPropertyName
Id property. The result map key that is used by the application to identify the bean internally. If omitted some internal key will be used -
getObject
provides the actual collection instance -
getObjectType
ReturnsCollection.class
-
isSingleton
public boolean isSingleton()The result bean is indeed a singleton
-