public class JythonObjectStore extends Object
IdvObjectStore object and
provides methods that are safe to use from Jython scripts.
A secondary aim of this class is to be largely API-compatible with
java.util.prefs.Preferences.
| Modifier and Type | Field and Description |
|---|---|
private IdvObjectStore |
idvStore
IdvObjectStore used by the current McIDAS-V session. |
| Modifier | Constructor and Description |
|---|---|
private |
JythonObjectStore(IdvObjectStore store)
Create a new
JythonObjectStore wrapper object. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
getBoolean(String key,
boolean defaultValue)
Returns the
boolean value associated with the given key. |
char |
getCharacter(String key,
char defaultValue)
Returns the
char value associated with the given key. |
double |
getDouble(String key,
double defaultValue)
Returns the
double value associated with the given key. |
float |
getFloat(String key,
float defaultValue)
Returns the
float value associated with the given key. |
int |
getInteger(String key,
int defaultValue)
Returns the
int value associated with the given key. |
long |
getLong(String key,
long defaultValue)
Returns the
long value associated with the given key. |
<T> T |
getObject(String key,
T defaultValue)
Returns the object associated with the given
key. |
short |
getShort(String key,
short defaultValue)
Returns the
short value associated with the given key. |
String |
getString(String key,
String defaultValue)
Returns the
String value associated with the given key. |
List<org.python.core.PyTuple> |
items() |
List<org.python.core.PyTuple> |
items(String substring) |
Set<String> |
keys() |
Set<String> |
keys(String substring) |
String |
listItems() |
String |
listKeys() |
String |
listMatchingItems(String substring) |
String |
listMatchingKeys(String substring) |
static JythonObjectStore |
newInstance(McIDASV mcidasv)
Return a new
JythonObjectStore instance. |
void |
putBoolean(String key,
boolean value)
Associates the given
key with the given boolean value. |
void |
putCharacter(String key,
char value)
Associates the given
key with the given char value. |
void |
putDouble(String key,
double value)
Associates the given
key with the given double value. |
void |
putFloat(String key,
float value)
Associates the given
key with the given float value. |
void |
putInteger(String key,
int value)
Associates the given
key with the given int value. |
void |
putLong(String key,
long value)
Associates the given
key with the given long value. |
<T> void |
putObject(String key,
T value)
Associates the given
key with the given object. |
void |
putShort(String key,
short value)
Associates the given
key with the given short value. |
void |
putString(String key,
String value)
Associates the given
key with the given String value. |
void |
remove(String key)
Removes the value associated with the given
key (if any). |
private final IdvObjectStore idvStore
IdvObjectStore used by the current McIDAS-V session.private JythonObjectStore(IdvObjectStore store)
JythonObjectStore wrapper object.store - McIDAS-V object store. Cannot be null.NullPointerException - if store is null.public static JythonObjectStore newInstance(McIDASV mcidasv)
JythonObjectStore instance.
Use this method rather than the constructor.
mcidasv - McIDAS-V instance that represents current session. Cannot
be null.JythonObjectStore class.NullPointerException - if mcidasv is null.public void remove(String key)
key (if any).key - Key whose associated value is to be removed. Cannot be
null.NullPointerException - if key is null.public <T> T getObject(String key, T defaultValue)
key. If key
does not exist, defaultValue is returned.T - Type of object that will be returned.key - Key whose associated object is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.
null is allowed.key or defaultValue if
key is not valid.NullPointerException - if key is null.public short getShort(String key, short defaultValue)
short value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated short value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.short value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public char getCharacter(String key, char defaultValue)
char value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated char value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.char value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public String getString(String key, String defaultValue)
String value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated String value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.String value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public boolean getBoolean(String key, boolean defaultValue)
boolean value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated boolean value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.boolean value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public double getDouble(String key, double defaultValue)
double value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated double value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.double value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public float getFloat(String key, float defaultValue)
float value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated float value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.float value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public int getInteger(String key, int defaultValue)
int value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated int value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.int value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public long getLong(String key, long defaultValue)
long value associated with the given key.
If key does not exist, defaultValue is returned.key - Key whose associated long value is to be returned.
Cannot be null.defaultValue - Value to be returned if key is not valid.long value associated with key or
defaultValue if key is not valid.NullPointerException - if key is null.public <T> void putObject(String key, T value)
key with the given object.T - Type of object to store.key - Key to associate with the given value.
Cannot be null.value - Object to associate with key. Cannot be
null.NullPointerException - if either key or value is
null.public void putShort(String key, short value)
key with the given short value.key - Key to associate with the given value.
Cannot be null.value - short value to associate with key.NullPointerException - if either key or value is
null.public void putCharacter(String key, char value)
key with the given char value.key - Key to associate with the given value.
Cannot be null.value - char value to associate with key.NullPointerException - if either key or value is
null.public void putString(String key, String value)
key with the given String value.key - Key to associate with the given value.
Cannot be null.value - String value to associate with key.
Cannot be null.NullPointerException - if either key or value is
null.public void putBoolean(String key, boolean value)
key with the given boolean value.key - Key to associate with the given value.
Cannot be null.value - boolean value to associate with key.NullPointerException - if either key or value is
null.public void putDouble(String key, double value)
key with the given double value.key - Key to associate with the given value.
Cannot be null.value - double value to associate with key.NullPointerException - if either key or value is
null.public void putFloat(String key, float value)
key with the given float value.key - Key to associate with the given value.
Cannot be null.value - float value to associate with key.NullPointerException - if either key or value is
null.public void putInteger(String key, int value)
key with the given int value.key - Key to associate with the given value.
Cannot be null.value - int value to associate with key.NullPointerException - if either key or value is
null.public void putLong(String key, long value)
key with the given long value.key - Key to associate with the given value.
Cannot be null.value - long value to associate with key.NullPointerException - if either key or value is
null.public String listMatchingKeys(String substring)
public String listMatchingItems(String substring)