Ejemplo n.º 1
0
 @SuppressWarnings({"unchecked", "rawtypes"})
 public Map<String, Object> getMap(String name) {
   String val = getValue(name);
   if (val == null) return null;
   Map<String, Object> map = (Map) JsonConverter.decode(val).get("state");
   return map;
 }
Ejemplo n.º 2
0
 /**
  * Returns the current value for a key.
  *
  * @param name the key name
  * @return the value or -1
  */
 public int getInteger(String name) {
   String val = getValue(name);
   Integer iVal = (Integer) JsonConverter.decode(val).get("state");
   if (iVal == null) {
     return -1;
   }
   return iVal.intValue();
 }
Ejemplo n.º 3
0
 /**
  * Sets a key.
  *
  * @param name the key name
  * @param value the value
  */
 public void set(String name, Object value) {
   Map<String, Object> map = new FastMap<Object>();
   map.put("state", value);
   setValue(name, JsonConverter.encode(map).toString());
   StateEvent re = new StateEvent(manager, name, value);
   re.setName(name);
   re.setValue(value);
   fireEvent(Events.StateChange, re);
 }
Ejemplo n.º 4
0
 /**
  * Returns the current value for a key.
  *
  * @param name the key name
  * @return the value
  */
 public Date getDate(String name) {
   String val = getValue(name);
   if (val == null) return null;
   Date date = (Date) JsonConverter.decode(val).get("state");
   return date;
 }
Ejemplo n.º 5
0
 /**
  * Returns the current value for a key.
  *
  * @param name the key name
  * @return the value
  */
 public boolean getBoolean(String name) {
   String val = getValue(name);
   if (val == null) return false;
   Boolean bVal = (Boolean) JsonConverter.decode(val).get("state");
   return bVal.booleanValue();
 }
Ejemplo n.º 6
0
 /**
  * Returns the current value for a key.
  *
  * @param name the key name
  * @return the value
  */
 public Object get(String name) {
   String val = getValue(name);
   if (val == null) return null;
   Object obj = JsonConverter.decode(val).get("state");
   return obj;
 }
Ejemplo n.º 7
0
 /**
  * Returns the current value for a key.
  *
  * @param name the key name
  * @return the value
  */
 public String getString(String name) {
   String val = getValue(name);
   if (val == null) return null;
   String obj = (String) JsonConverter.decode(val).get("state");
   return obj;
 }