Package org.cyclos.server.utils
Class JacksonParameterStorage
- java.lang.Object
-
- org.cyclos.utils.AbstractParameterStorage
-
- org.cyclos.server.utils.JacksonParameterStorage
-
- All Implemented Interfaces:
ObjectParameterStorage,ParameterStorage
- Direct Known Subclasses:
EntityBackedParameterStorage
public class JacksonParameterStorage extends AbstractParameterStorage implements ObjectParameterStorage
AParameterStoragelinked to a Jackson object. Object values are cached, so the same Java object is returned on multiple calls. However, be careful: mutating the returned object doesn't update the storage.
-
-
Constructor Summary
Constructors Constructor Description JacksonParameterStorage(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>cache()protected voiddoSet(String name, List<String> values)Must be implemented to actually set the underlying value as a list of stringsIterator<String>getNames()Returns the names of all parameters with valuesObjectgetObject(String name)Returns a parameter as an object value, or null if the parameter is not setStringgetString(String name)Returns the parameter as a string, or null if the parameter is not setList<String>getStringList(String name)Returns the parameter as a list of strings, or null if the parameter is not setprotected voidonChange()Callback invoked when something changes.ObjectpropertyMissing(String name)Support method for Groovy scripts to handle propertiesvoidpropertyMissing(String name, Object value)Support method for Groovy scripts to handle propertiesvoidremove(String name)Removes the parameter with the given namevoidsetObject(String name, Object value)Sets the parameter with the given name as an object valueStringtoString()-
Methods inherited from class org.cyclos.utils.AbstractParameterStorage
getBoolean, getDate, getDecimal, getDecimalList, getEnum, getEnumList, getInteger, getIntegerList, getLong, getLongList, isSet, setBoolean, setDate, setDecimal, setEnum, setInteger, setLong, setString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.cyclos.utils.ParameterStorage
getBoolean, getDate, getDecimal, getDecimalList, getEnum, getEnumList, getInteger, getIntegerList, getLong, getLongList, isSet, setBoolean, setDate, setDecimal, setEnum, setInteger, setLong, setString
-
-
-
-
Constructor Detail
-
JacksonParameterStorage
public JacksonParameterStorage(com.fasterxml.jackson.databind.ObjectMapper objectMapper, Object input)
-
-
Method Detail
-
getNames
public Iterator<String> getNames()
Description copied from interface:ParameterStorageReturns the names of all parameters with values- Specified by:
getNamesin interfaceParameterStorage
-
getObject
public Object getObject(String name)
Description copied from interface:ObjectParameterStorageReturns a parameter as an object value, or null if the parameter is not set- Specified by:
getObjectin interfaceObjectParameterStorage
-
getString
public String getString(String name)
Description copied from interface:ParameterStorageReturns the parameter as a string, or null if the parameter is not set- Specified by:
getStringin interfaceParameterStorage
-
getStringList
public List<String> getStringList(String name)
Description copied from interface:ParameterStorageReturns the parameter as a list of strings, or null if the parameter is not set- Specified by:
getStringListin interfaceParameterStorage
-
propertyMissing
public Object propertyMissing(String name)
Support method for Groovy scripts to handle properties
-
propertyMissing
public void propertyMissing(String name, Object value)
Support method for Groovy scripts to handle properties
-
remove
public void remove(String name)
Description copied from interface:ParameterStorageRemoves the parameter with the given name- Specified by:
removein interfaceParameterStorage
-
setObject
public void setObject(String name, Object value)
Description copied from interface:ObjectParameterStorageSets the parameter with the given name as an object value- Specified by:
setObjectin interfaceObjectParameterStorage
-
toString
public String toString()
- Overrides:
toStringin classAbstractParameterStorage
-
doSet
protected void doSet(String name, List<String> values)
Description copied from class:AbstractParameterStorageMust be implemented to actually set the underlying value as a list of strings- Specified by:
doSetin classAbstractParameterStorage
-
onChange
protected void onChange()
Callback invoked when something changes. No-op by default.
-
-