public class GlobalDataStore extends Object
Modifier and Type | Method and Description |
---|---|
static GlobalDataStore |
getInstance()
Use this method to get the instance of the of this class.
|
<T> T |
getStaticData(String key)
Use this method to retrieve the data that has been stored to be available across the whole execution.
|
<T> T |
getStaticData(String key,
Object defaultValue)
Use this method to retrieve the data that has been stored to be available across the whole execution.
|
<T> T |
getThreadData(String key)
Use this method to retrieve the data that has been stored for a particular thread.
|
<T> T |
getThreadData(String key,
Object defaultValue)
Use this method to retrieve the data that has been stored for a particular thread.
|
void |
putStaticData(String key,
Object value)
Stores data in a static way this data will available to the whole execution.
|
void |
putThreadData(String key,
String value)
Stores data in way that is will be available for a particular thread.
|
public static GlobalDataStore getInstance()
GlobalDataStore
singleton instancepublic void putStaticData(String key, Object value)
key
- Name to be used to refer to the said data.value
- The data object that you need to store this can be any object.public void putThreadData(String key, String value)
key
- Name to be used to refer to the said data.value
- The data object that you need to store this can be any object.public <T> T getThreadData(String key)
key
- The key which was used to store the datanull
in case no key was found.public <T> T getStaticData(String key)
key
- The key which was used to store the datanull
in case no key was found.public <T> T getThreadData(String key, Object defaultValue)
key
- The key which was used to store the datadefaultValue
- The default value that needs to be returned in case the key is not found.defaultValue
in case no key was found.public <T> T getStaticData(String key, Object defaultValue)
key
- The key which was used to store the datadefaultValue
- The default value that needs to be returned in case the key is not found.defaultValue
in case no key was found.Copyright © 2014. All rights reserved.