org.progeeks.util.beans
Class SingletonConfigurator

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap
              extended by org.progeeks.util.beans.BeanConfigurator
                  extended by org.progeeks.util.beans.SingletonConfigurator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class SingletonConfigurator
extends BeanConfigurator

Specialized version of BeanConfigurator that will implement singleton getInstance() behavior with some advanced features. For normal createBean(), a single instance will be created the first time it is called and then returned again upon subsequent calls. For the createBean() that takes constructor arguments, the argument is used as a key into a singleton registry so that if the same arguments are passed again then the originally created object will be returned.

Version:
$Revision: 1.4 $
Author:
Paul Speed
See Also:
Serialized Form

Constructor Summary
SingletonConfigurator()
          Constructs a bean configurator that is not specific to any bean class.
SingletonConfigurator(java.lang.Class beanClass)
          Constructs a bean configurator that can instantiate and configure beans of the specified concrete class.
 
Method Summary
 java.lang.Object createBean()
          Creates a configures a bean of this configurator's associated bean type.
 java.lang.Object createBean(java.lang.Object[] args)
          Creates a configures a bean passing the specified arguments on the constructor.
 java.lang.String toString()
           
 
Methods inherited from class org.progeeks.util.beans.BeanConfigurator
addConfiguratorListener, configureBean, equals, fireBeanCreated, getAppendCollections, getBeanClass, getOverwriteExistingValues, hasConstructor, hasConstructor, put, removeConfiguratorListener, setAppendCollections, setCollectionValue, setMapValue, setOverwriteExistingValues, setValue
 
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, get, removeEldestEntry
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
hashCode
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, entrySet, hashCode, isEmpty, keySet, putAll, remove, size, values
 

Constructor Detail

SingletonConfigurator

public SingletonConfigurator()
Constructs a bean configurator that is not specific to any bean class.


SingletonConfigurator

public SingletonConfigurator(java.lang.Class beanClass)
Constructs a bean configurator that can instantiate and configure beans of the specified concrete class.

Method Detail

createBean

public java.lang.Object createBean()
Creates a configures a bean of this configurator's associated bean type.

Overrides:
createBean in class BeanConfigurator

createBean

public java.lang.Object createBean(java.lang.Object[] args)
Creates a configures a bean passing the specified arguments on the constructor.

Overrides:
createBean in class BeanConfigurator

toString

public java.lang.String toString()
Overrides:
toString in class BeanConfigurator


Copyright © 2002-2003 Paul Speed. All Rights Reserved.