Class SetFactoryBean
- java.lang.Object
- org.springframework.beans.factory.config.AbstractFactoryBean<Set<Object>>
- org.springframework.beans.factory.config.SetFactoryBean
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,DisposableBean
,FactoryBean<Set<Object>>
,InitializingBean
public class SetFactoryBean extends AbstractFactoryBean<Set<Object>>
Simple factory for shared Set instances. Allows for central setup of Sets via the "set" element in XML bean definitions.- Since:
- 09.12.2003
- Author:
- Juergen Hoeller
- See Also:
ListFactoryBean
,MapFactoryBean
Field Summary
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
Constructor Summary
Constructors Constructor Description SetFactoryBean()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<Object>
createInstance()
Template method that subclasses must override to construct the object returned by this factory.Class<Set>
getObjectType()
This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.void
setSourceSet(Set<?> sourceSet)
Set the source Set, typically populated via XML "set" elements.void
setTargetSetClass(Class<? extends Set> targetSetClass)
Set the class to use for the target Set.Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, destroyInstance, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
Constructor Detail
SetFactoryBean
public SetFactoryBean()
Method Detail
setSourceSet
public void setSourceSet(Set<?> sourceSet)
Set the source Set, typically populated via XML "set" elements.
setTargetSetClass
public void setTargetSetClass(@Nullable Class<? extends Set> targetSetClass)
Set the class to use for the target Set. Can be populated with a fully qualified class name when defined in a Spring application context.Default is a linked HashSet, keeping the registration order.
- See Also:
LinkedHashSet
getObjectType
public Class<Set> getObjectType()
Description copied from class:AbstractFactoryBean
This abstract method declaration mirrors the method in the FactoryBean interface, for a consistent offering of abstract template methods.- Specified by:
getObjectType
in interfaceFactoryBean<Set<Object>>
- Specified by:
getObjectType
in classAbstractFactoryBean<Set<Object>>
- Returns:
- the type of object that this FactoryBean creates, or
null
if not known at the time of the call - See Also:
FactoryBean.getObjectType()
createInstance
protected Set<Object> createInstance()
Description copied from class:AbstractFactoryBean
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
AbstractFactoryBean.getObject()
call.- Specified by:
createInstance
in classAbstractFactoryBean<Set<Object>>
- Returns:
- the object returned by this factory
- See Also:
AbstractFactoryBean.getObject()