Package edu.wisc.ssec.mcidasv.util
Class JythonObjectStore
java.lang.Object
edu.wisc.ssec.mcidasv.util.JythonObjectStore
Wraps the application's
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
.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final IdvObjectStore
IdvObjectStore
used by the current McIDAS-V session. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
JythonObjectStore
(IdvObjectStore store) Create a newJythonObjectStore
wrapper object. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getBoolean
(String key, boolean defaultValue) Returns theboolean
value associated with the givenkey
.char
getCharacter
(String key, char defaultValue) Returns thechar
value associated with the givenkey
.double
Returns thedouble
value associated with the givenkey
.float
Returns thefloat
value associated with the givenkey
.int
getInteger
(String key, int defaultValue) Returns theint
value associated with the givenkey
.long
Returns thelong
value associated with the givenkey
.<T> T
Returns the object associated with the givenkey
.short
Returns theshort
value associated with the givenkey
.Returns theString
value associated with the givenkey
.List
<org.python.core.PyTuple> items()
List
<org.python.core.PyTuple> keys()
listKeys()
listMatchingItems
(String substring) listMatchingKeys
(String substring) static JythonObjectStore
newInstance
(McIDASV mcidasv) Return a newJythonObjectStore
instance.void
putBoolean
(String key, boolean value) Associates the givenkey
with the givenboolean
value.void
putCharacter
(String key, char value) Associates the givenkey
with the givenchar
value.void
Associates the givenkey
with the givendouble
value.void
Associates the givenkey
with the givenfloat
value.void
putInteger
(String key, int value) Associates the givenkey
with the givenint
value.void
Associates the givenkey
with the givenlong
value.<T> void
Associates the givenkey
with the given object.void
Associates the givenkey
with the givenshort
value.void
Associates the givenkey
with the givenString
value.void
Removes the value associated with the givenkey
(if any).
-
Field Details
-
idvStore
IdvObjectStore
used by the current McIDAS-V session.
-
-
Constructor Details
-
JythonObjectStore
Create a newJythonObjectStore
wrapper object.- Parameters:
store
- McIDAS-V object store. Cannot benull
.- Throws:
NullPointerException
- ifstore
isnull
.
-
-
Method Details
-
newInstance
Return a newJythonObjectStore
instance.Use this method rather than the constructor.
- Parameters:
mcidasv
- McIDAS-V instance that represents current session. Cannot benull
.- Returns:
- New instance of the
JythonObjectStore
class. - Throws:
NullPointerException
- ifmcidasv
isnull
.
-
remove
Removes the value associated with the givenkey
(if any).- Parameters:
key
- Key whose associated value is to be removed. Cannot benull
.- Throws:
NullPointerException
- ifkey
isnull
.
-
getObject
Returns the object associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Type Parameters:
T
- Type of object that will be returned.- Parameters:
key
- Key whose associated object is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.null
is allowed.- Returns:
- Object associated with
key
ordefaultValue
ifkey
is not valid. - Throws:
NullPointerException
- ifkey
isnull
.
-
getShort
Returns theshort
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedshort
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
short
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getCharacter
Returns thechar
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedchar
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
char
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getString
Returns theString
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedString
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
String
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getBoolean
Returns theboolean
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedboolean
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
boolean
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getDouble
Returns thedouble
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associateddouble
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
double
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getFloat
Returns thefloat
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedfloat
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
float
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getInteger
Returns theint
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedint
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
int
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
getLong
Returns thelong
value associated with the givenkey
. Ifkey
does not exist,defaultValue
is returned.- Parameters:
key
- Key whose associatedlong
value is to be returned. Cannot benull
.defaultValue
- Value to be returned ifkey
is not valid.- Returns:
long
value associated withkey
ordefaultValue
ifkey
is not valid.- Throws:
NullPointerException
- ifkey
isnull
.
-
putObject
Associates the givenkey
with the given object.- Type Parameters:
T
- Type of object to store.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
- Object to associate withkey
. Cannot benull
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putShort
Associates the givenkey
with the givenshort
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-short
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putCharacter
Associates the givenkey
with the givenchar
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-char
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putString
Associates the givenkey
with the givenString
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-String
value to associate withkey
. Cannot benull
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putBoolean
Associates the givenkey
with the givenboolean
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-boolean
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putDouble
Associates the givenkey
with the givendouble
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-double
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putFloat
Associates the givenkey
with the givenfloat
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-float
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putInteger
Associates the givenkey
with the givenint
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-int
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
putLong
Associates the givenkey
with the givenlong
value.- Parameters:
key
- Key to associate with the givenvalue
. Cannot benull
.value
-long
value to associate withkey
.- Throws:
NullPointerException
- if eitherkey
orvalue
isnull
.
-
keys
-
keys
-
items
-
items
-
listKeys
-
listMatchingKeys
-
listItems
-
listMatchingItems
-