Package org.jboss.weld.bootstrap.api
Class SingletonProvider
java.lang.Object
org.jboss.weld.bootstrap.api.SingletonProvider
- Direct Known Subclasses:
IsolatedStaticSingletonProvider,RegistrySingletonProvider,TCCLSingletonProvider
A provider of
Singletons- Author:
- Sanjeeb.Sahoo@Sun.COM, Pete Muir
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T> Singleton<T>Create a new singletonstatic voidinitialize(SingletonProvider instance) Initialize with an explicit instancestatic SingletonProviderinstance()Returns a singleton instance of this class.static voidreset()Sets the reference to the singleton instance of this class back tonull.
-
Constructor Details
-
SingletonProvider
protected SingletonProvider()Protected constructor.instance()should be used to obtain an instance of this class.
-
-
Method Details
-
instance
Returns a singleton instance of this class.- Returns:
SingletonProviderinstance
-
create
Create a new singleton- Type Parameters:
T- type of Java object stored in the singleton- Parameters:
expectedType- represents the type of Java object stored in the singleton- Returns:
- a singelton
-
initialize
Initialize with an explicit instance- Parameters:
instance- the explicit instance
-
reset
public static void reset()Sets the reference to the singleton instance of this class back tonull.
-