Class PropertiesBeanProvider
- java.lang.Object
-
- net.sf.jguiraffe.di.impl.providers.SimpleBeanProvider
-
- net.sf.jguiraffe.di.impl.providers.MapBeanProvider
-
- net.sf.jguiraffe.di.impl.providers.PropertiesBeanProvider
-
- All Implemented Interfaces:
BeanProvider
public class PropertiesBeanProvider extends MapBeanProvider
A specialized
BeanProviderimplementation for creating ajava.util.Propertiesobject.This class works analogously to
, but it creates a specialized map: aMapBeanProviderPropertiesobject. Because the major part of the functionality required is already implemented by the super class this implementation can be very simple. It merely has to override thecreateMap()method to return aPropertiesinstance.This class stands in a similar relation to
MapBeanProviderasjava.util.Propertiesstands to its ancestorjava.util.HashMap:Propertiesoperates on string keys and values, but through the methods inherited from its base class it is possible to store data of other types as well. The same is true for thisBeanProviderimplementation. It accepts any kind of dependencies for keys and values and does not perform a type check. So it lies in the responsibility of the user to populate thePropertiesobject only with valid keys and values.- Version:
- $Id: PropertiesBeanProvider.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description PropertiesBeanProvider(Collection<Dependency> keyDeps, Collection<Dependency> valDeps)Creates a new instance ofPropertiesBeanProviderand initializes it with the dependencies for keys and values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<Object,Object>createMap()Creates the map managed by this bean provider.-
Methods inherited from class net.sf.jguiraffe.di.impl.providers.MapBeanProvider
getBean, getBeanClass, getDependencies, getKeyDependencies, getValueDependencies, isOrdered
-
Methods inherited from class net.sf.jguiraffe.di.impl.providers.SimpleBeanProvider
getLockID, isBeanAvailable, setLockID, shutdown
-
-
-
-
Constructor Detail
-
PropertiesBeanProvider
public PropertiesBeanProvider(Collection<Dependency> keyDeps, Collection<Dependency> valDeps)
Creates a new instance ofPropertiesBeanProviderand initializes it with the dependencies for keys and values. Note that theorderedflag supported by the super class does not make sense in this context.- Parameters:
keyDeps- the dependencies for the property keys (must not be null)valDeps- the dependencies for the property values (must not be null)- Throws:
IllegalArgumentException- if eitherkeyDepsorvalDepsis null or the sizes of the collections are different
-
-
Method Detail
-
createMap
protected Map<Object,Object> createMap()
Creates the map managed by this bean provider. This implementation constructs a newPropertiesobject.- Overrides:
createMapin classMapBeanProvider- Returns:
- the map managed by this bean provider
-
-