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 IdvObjectStoreIdvObjectStoreused by the current McIDAS-V session. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateJythonObjectStore(IdvObjectStore store) Create a newJythonObjectStorewrapper object. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolean(String key, boolean defaultValue) Returns thebooleanvalue associated with the givenkey.chargetCharacter(String key, char defaultValue) Returns thecharvalue associated with the givenkey.doubleReturns thedoublevalue associated with the givenkey.floatReturns thefloatvalue associated with the givenkey.intgetInteger(String key, int defaultValue) Returns theintvalue associated with the givenkey.longReturns thelongvalue associated with the givenkey.<T> TReturns the object associated with the givenkey.shortReturns theshortvalue associated with the givenkey.Returns theStringvalue associated with the givenkey.List<org.python.core.PyTuple> items()List<org.python.core.PyTuple> keys()listKeys()listMatchingItems(String substring) listMatchingKeys(String substring) static JythonObjectStorenewInstance(McIDASV mcidasv) Return a newJythonObjectStoreinstance.voidputBoolean(String key, boolean value) Associates the givenkeywith the givenbooleanvalue.voidputCharacter(String key, char value) Associates the givenkeywith the givencharvalue.voidAssociates the givenkeywith the givendoublevalue.voidAssociates the givenkeywith the givenfloatvalue.voidputInteger(String key, int value) Associates the givenkeywith the givenintvalue.voidAssociates the givenkeywith the givenlongvalue.<T> voidAssociates the givenkeywith the given object.voidAssociates the givenkeywith the givenshortvalue.voidAssociates the givenkeywith the givenStringvalue.voidRemoves the value associated with the givenkey(if any).
-
Field Details
-
idvStore
IdvObjectStoreused by the current McIDAS-V session.
-
-
Constructor Details
-
JythonObjectStore
Create a newJythonObjectStorewrapper object.- Parameters:
store- McIDAS-V object store. Cannot benull.- Throws:
NullPointerException- ifstoreisnull.
-
-
Method Details
-
newInstance
Return a newJythonObjectStoreinstance.Use this method rather than the constructor.
- Parameters:
mcidasv- McIDAS-V instance that represents current session. Cannot benull.- Returns:
- New instance of the
JythonObjectStoreclass. - Throws:
NullPointerException- ifmcidasvisnull.
-
remove
Removes the value associated with the givenkey(if any).- Parameters:
key- Key whose associated value is to be removed. Cannot benull.- Throws:
NullPointerException- ifkeyisnull.
-
getObject
Returns the object associated with the givenkey. Ifkeydoes not exist,defaultValueis 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 ifkeyis not valid.nullis allowed.- Returns:
- Object associated with
keyordefaultValueifkeyis not valid. - Throws:
NullPointerException- ifkeyisnull.
-
getShort
Returns theshortvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedshortvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
shortvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getCharacter
Returns thecharvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedcharvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
charvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getString
Returns theStringvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedStringvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
Stringvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getBoolean
Returns thebooleanvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedbooleanvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
booleanvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getDouble
Returns thedoublevalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associateddoublevalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
doublevalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getFloat
Returns thefloatvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedfloatvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
floatvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getInteger
Returns theintvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedintvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
intvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
getLong
Returns thelongvalue associated with the givenkey. Ifkeydoes not exist,defaultValueis returned.- Parameters:
key- Key whose associatedlongvalue is to be returned. Cannot benull.defaultValue- Value to be returned ifkeyis not valid.- Returns:
longvalue associated withkeyordefaultValueifkeyis not valid.- Throws:
NullPointerException- ifkeyisnull.
-
putObject
Associates the givenkeywith 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 eitherkeyorvalueisnull.
-
putShort
Associates the givenkeywith the givenshortvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-shortvalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putCharacter
Associates the givenkeywith the givencharvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-charvalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putString
Associates the givenkeywith the givenStringvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-Stringvalue to associate withkey. Cannot benull.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putBoolean
Associates the givenkeywith the givenbooleanvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-booleanvalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putDouble
Associates the givenkeywith the givendoublevalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-doublevalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putFloat
Associates the givenkeywith the givenfloatvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-floatvalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putInteger
Associates the givenkeywith the givenintvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-intvalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
putLong
Associates the givenkeywith the givenlongvalue.- Parameters:
key- Key to associate with the givenvalue. Cannot benull.value-longvalue to associate withkey.- Throws:
NullPointerException- if eitherkeyorvalueisnull.
-
keys
-
keys
-
items
-
items
-
listKeys
-
listMatchingKeys
-
listItems
-
listMatchingItems
-