public class StorageManager extends Object implements StorageProvider, ObjectStorage, PersistableStorage
StorageProvider.StorageObject
GLOBAL, LOCAL, SESSION
Modifier and Type | Method and Description |
---|---|
boolean |
getBooleanProperty(String key)
Gets the boolean property.
|
boolean |
getBooleanProperty(String key,
boolean def)
Gets the boolean property.
|
Date |
getDateProperty(String key,
Date def,
String format)
Gets the date property.
|
Date |
getDateProperty(String key,
String format)
Gets the date property.
|
double |
getDoubleProperty(String key)
Gets the double property.
|
double |
getDoubleProperty(String key,
double def)
Gets the double property.
|
float |
getFloatProperty(String key)
Gets the float property.
|
float |
getFloatProperty(String key,
float def)
Gets the float property.
|
int |
getIntProperty(String key)
Gets the int property.
|
int |
getIntProperty(String key,
int def)
Gets the int property.
|
long |
getLongProperty(String key)
Gets the long property.
|
long |
getLongProperty(String key,
long def)
Gets the long property.
|
Number |
getNumberProperty(String key)
Gets the number property.
|
Number |
getNumberProperty(String key,
Number def)
Gets the number property.
|
Map<String,StorageProvider.StorageObject> |
getProperties()
Gets the properties.
|
Object |
getProperty(String key)
Gets the property.
|
Object |
getProperty(String key,
Object def)
Gets the property.
|
String |
getString(String key)
Gets the string representation of the value by the key.
|
String |
getStringProperty(String key)
Gets the string property.
|
String |
getStringProperty(String key,
String def)
Gets the string property.
|
Object |
getValue(String key)
Gets the value by the key.
|
void |
init()
Initializes the storage.
|
void |
initProvider()
Initializes the StorageProvider.
|
static StorageManager |
instance()
Returns an instance of the StorageManager.
|
void |
load()
Loads properties.
|
void |
load(List<String> keys)
Loads only properties which belong to the given keys list.
|
Object |
removeProperty(String key)
Removes the property.
|
void |
setProperties(String text)
Sets the properties by parsing string like key;value|key;value.
|
Object |
setProperty(String key,
Object value)
Sets the property.
|
Object |
setProperty(String key,
StorageProvider.StorageObject value)
Sets the property.
|
void |
setValue(String key,
Object value)
Associates value with the key.
|
void |
store()
Stores properties.
|
void |
store(Map<String,StorageProvider.StorageObject> properties)
Stores only given properties.
|
public static StorageManager instance()
public boolean getBooleanProperty(String key)
key
- the keypublic boolean getBooleanProperty(String key, boolean def)
key
- the keydef
- the default valuepublic Date getDateProperty(String key, Date def, String format)
key
- the keydef
- the default valueformat
- the formatpublic Date getDateProperty(String key, String format)
key
- the keyformat
- the formatpublic double getDoubleProperty(String key)
key
- the keypublic double getDoubleProperty(String key, double def)
key
- the keydef
- the default valuepublic float getFloatProperty(String key)
key
- the keypublic float getFloatProperty(String key, float def)
key
- the keydef
- the default valuepublic int getIntProperty(String key)
key
- the keypublic int getIntProperty(String key, int def)
key
- the keydef
- the default valuepublic long getLongProperty(String key)
key
- the keypublic long getLongProperty(String key, long def)
key
- the keydef
- the default valuepublic Number getNumberProperty(String key)
key
- the keypublic Number getNumberProperty(String key, Number def)
key
- the keydef
- the default valuepublic Map<String,StorageProvider.StorageObject> getProperties()
StorageProvider
getProperties
in interface StorageProvider
public Object getProperty(String key)
StorageProvider
getProperty
in interface StorageProvider
key
- the keypublic Object getProperty(String key, Object def)
StorageProvider
getProperty
in interface StorageProvider
key
- the keydef
- the defpublic String getString(String key)
ObjectStorage
getString
in interface ObjectStorage
key
- the keypublic String getStringProperty(String key)
key
- the keypublic String getStringProperty(String key, String def)
key
- the keydef
- the default valuepublic Object getValue(String key)
ObjectStorage
getValue
in interface ObjectStorage
key
- the keypublic void init() throws Exception
PersistableStorage
init
in interface PersistableStorage
Exception
- in case of any errorpublic void initProvider()
public void load() throws Exception
PersistableStorage
load
in interface PersistableStorage
Exception
- in case of any errorpublic void load(List<String> keys) throws Exception
PersistableStorage
load
in interface PersistableStorage
keys
- the keysException
- in case of any errorpublic Object removeProperty(String key)
StorageProvider
removeProperty
in interface StorageProvider
key
- the keypublic void setProperties(String text)
text
- the new propertiespublic Object setProperty(String key, Object value)
key
- the keyvalue
- the valuepublic Object setProperty(String key, StorageProvider.StorageObject value)
StorageProvider
setProperty
in interface StorageProvider
key
- the keyvalue
- the valuepublic void setValue(String key, Object value)
ObjectStorage
setValue
in interface ObjectStorage
key
- the keyvalue
- the valuepublic void store() throws Exception
PersistableStorage
store
in interface PersistableStorage
Exception
- in case of any errorpublic void store(Map<String,StorageProvider.StorageObject> properties) throws Exception
PersistableStorage
store
in interface PersistableStorage
properties
- the propertiesException
- in case of any errorCopyright © 2010-2020 Toolsverse. All Rights Reserved.