Top Description Fields Constructors Methods
org.springframework.beans.factory.config

public Class MapFactoryBean

extends AbstractFactoryBean<Map<Object, Object>>
Class Inheritance
Imports
java.util.Map, org.springframework.beans.BeanUtils, .TypeConverter, org.springframework.core.ResolvableType, org.springframework.lang.Nullable, org.springframework.util.CollectionUtils

Simple factory for shared Map instances. Allows for central setup of Maps via the "map" element in XML bean definitions.
Author
Juergen Hoeller
Since
09.12.2003
See Also
SetFactoryBean, ListFactoryBean

Field Summary

Modifier and TypeField and Description
private Map<?, ?>
private Class<? extends Map<K, V>>
Inherited from org.springframework.beans.factory.config.AbstractFactoryBean:
logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected Map<Object, Object>
createInstance()

Implements abstract org.springframework.beans.factory.config.AbstractFactoryBean.createInstance.

Template method that subclasses must override to construct the object returned by this factory.

public Class<Map<K, V>>
getObjectType()

Implements abstract org.springframework.beans.factory.config.AbstractFactoryBean.getObjectType.

Implements org.springframework.beans.factory.FactoryBean.getObjectType.

This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.

public void
setSourceMap(Map<?, ?> sourceMap)

Set the source Map, typically populated via XML "map" elements.

public void
setTargetMapClass(Class<? extends Map<K, V>> targetMapClass)

Set the class to use for the target Map.

Inherited from org.springframework.beans.factory.config.AbstractFactoryBean:
afterPropertiesSetdestroydestroyInstancegetBeanFactorygetBeanTypeConvertergetEarlySingletonInterfacesgetObjectisSingletonsetBeanClassLoadersetBeanFactorysetSingleton

Field Detail

sourceMapback to summary
private Map<?, ?> sourceMap
Annotations
@Nullable
targetMapClassback to summary
private Class<? extends Map<K, V>> targetMapClass
Annotations
@SuppressWarnings:rawtypes
@Nullable

Constructor Detail

MapFactoryBeanback to summary
public MapFactoryBean()

Method Detail

createInstanceback to summary
protected Map<Object, Object> createInstance()

Implements abstract org.springframework.beans.factory.config.AbstractFactoryBean.createInstance.

Doc from org.springframework.beans.factory.config.AbstractFactoryBean.createInstance.

Template method that subclasses must override to construct the object returned by this factory.

Invoked on initialization of this FactoryBean in case of a singleton; else, on each getObject() call.

Returns:Map<Object, Object>

the object returned by this factory

Annotations
@Override
@SuppressWarnings:unchecked
getObjectTypeback to summary
public Class<Map<K, V>> getObjectType()

Implements abstract org.springframework.beans.factory.config.AbstractFactoryBean.getObjectType.

Implements org.springframework.beans.factory.FactoryBean.getObjectType.

Doc from org.springframework.beans.factory.config.AbstractFactoryBean.getObjectType.

This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.

Returns:Class<Map<K, V>>

Doc from org.springframework.beans.factory.FactoryBean.getObjectType.

the type of object that this FactoryBean creates, or null if not known at the time of the call

Annotations
@Override
@SuppressWarnings:rawtypes
setSourceMapback to summary
public void setSourceMap(Map<?, ?> sourceMap)

Set the source Map, typically populated via XML "map" elements.

setTargetMapClassback to summary
public void setTargetMapClass(Class<? extends Map<K, V>> targetMapClass)

Set the class to use for the target Map. Can be populated with a fully qualified class name when defined in a Spring application context.

Default is a linked HashMap, keeping the registration order.

Annotations
@SuppressWarnings:rawtypes
See Also
java.util.LinkedHashMap