public class SingletonCreator
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SingletonCreator.Creator<T>
abstract class used to for the Singleton creation.
|
static class |
SingletonCreator.SingletonCreateException |
static class |
SingletonCreator.SingletonDestroyException |
| Modifier and Type | Field and Description |
|---|---|
static Logger |
log |
| Constructor and Description |
|---|
SingletonCreator()
creates a new SingletonCreator instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
destroy()
destroys this SingletonCreator instance this method will call the destroy() method of each
SingletonCreator.Creator instance that was used when calling getSingleton() in reverse order to allow you to
cleanup correctly
|
<T> T |
getSingleton(java.lang.Class<T> clazz)
returns a single instance of the specified class.
|
<T> T |
getSingleton(SingletonCreator.Creator<T> creator)
returns a single instance created by the given Creator.
|
<T> T |
getSingletonIfExists(SingletonCreator.Creator<T> creator) |
boolean |
isDestroyed() |
<T> T |
replaceSingleton(SingletonCreator.Creator<T> creator) |
public SingletonCreator()
public <T> T getSingleton(java.lang.Class<T> clazz)
clazz - the Class for which the instance should be createdpublic <T> T getSingleton(SingletonCreator.Creator<T> creator)
creator - the Creatorpublic <T> T replaceSingleton(SingletonCreator.Creator<T> creator)
public <T> T getSingletonIfExists(SingletonCreator.Creator<T> creator)
public void destroy()
public boolean isDestroyed()
public void clear()
Copyright © 2018 SAP SE. All Rights Reserved.