public abstract class Settings extends Object
Constructor and Description |
---|
Settings() |
Modifier and Type | Method and Description |
---|---|
boolean |
getBoolean(String key)
Returns a boolean value that corresponds to the given key.
|
boolean |
getBoolean(String key,
boolean defaultValue)
Returns a boolean value that corresponds to the given key.
|
int |
getInteger(String key)
Returns an integer value that corresponds to the given key.
|
int |
getInteger(String key,
int defaultValue)
Returns an integer value that corresponds to the given key.
|
long |
getLong(String key)
Returns a long value that corresponds to the given key.
|
long |
getLong(String key,
long defaultValue)
Returns a long value that corresponds to the given key.
|
String |
getString(String key)
Returns a string value that corresponds to the given key.
|
String |
getString(String key,
String defaultValue)
Returns a string value that corresponds to the given key.
|
boolean |
isDefined(String key)
Returns true if a corresponding value for the specified key is found, false otherwise.
|
void |
setBoolean(String key,
boolean value)
Sets the value corresponding to the given key.
|
void |
setBoolean(String key,
boolean value,
boolean flush)
Sets the value corresponding to the given key.
|
void |
setInteger(String key,
int value)
Sets the value corresponding to the given key.
|
void |
setInteger(String key,
int value,
boolean flush)
Sets the value corresponding to the given key.
|
void |
setLong(String key,
long value)
Sets the value corresponding to the given key.
|
void |
setLong(String key,
long value,
boolean flush)
Sets the value corresponding to the given key.
|
void |
setString(String key,
String value)
Sets the value corresponding to the given key.
|
void |
setString(String key,
String value,
boolean flush)
Sets the value corresponding to the given key.
|
public boolean getBoolean(String key)
key
- keyIllegalArgumentException
- if key is null or empty;
also if value cannot be found for the specified keypublic boolean getBoolean(String key, boolean defaultValue)
key
- keydefaultValue
- default valueIllegalArgumentException
- if key is null or emptypublic void setBoolean(String key, boolean value) throws IOException
key
- keyvalue
- valueIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic void setBoolean(String key, boolean value, boolean flush) throws IOException
key
- keyvalue
- valueflush
- whether to save to persistent storage immediatelyIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic String getString(String key)
key
- keyIllegalArgumentException
- if key is null or empty;
also if value cannot be found for the specified keypublic String getString(String key, String defaultValue)
key
- keydefaultValue
- default valueIllegalArgumentException
- if key is null or emptyNullPointerException
- if defaultValue is nullpublic void setString(String key, String value) throws IOException
key
- keyvalue
- valueIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic void setString(String key, String value, boolean flush) throws IOException
key
- keyvalue
- valueflush
- whether to save to persistent storage immediatelyIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic int getInteger(String key, int defaultValue)
key
- keydefaultValue
- default valueIllegalArgumentException
- if key is null or emptyNumberFormatException
- if value cannot be parsed to integerpublic int getInteger(String key)
key
- keyIllegalArgumentException
- if key is null or empty;
also if value cannot be found for the specified keyNumberFormatException
- if value cannot be parsed to integerpublic void setInteger(String key, int value) throws IOException
key
- keyvalue
- valueIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic void setInteger(String key, int value, boolean flush) throws IOException
key
- keyvalue
- valueflush
- whether to save to persistent storage immediatelyIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic long getLong(String key, long defaultValue)
key
- keydefaultValue
- default valueIllegalArgumentException
- if key is null or emptyNumberFormatException
- if value cannot be parsed to integerpublic long getLong(String key)
key
- keyIllegalArgumentException
- if key is null or empty;
also if value cannot be found for the specified keyNumberFormatException
- if value cannot be parsed to longpublic void setLong(String key, long value) throws IOException
key
- keyvalue
- valueIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic void setLong(String key, long value, boolean flush) throws IOException
key
- keyvalue
- valueflush
- whether to save to persistent storage immediatelyIOException
- if value storing failedIllegalArgumentException
- if key is null or emptypublic boolean isDefined(String key)
key
- keyIllegalArgumentException
- if key is null or emptyCopyright © 2005–2024 Onix Solutions. All rights reserved.