mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Store settings in the DB, listen for events when settings are updated.
This commit is contained in:
29
briar-api/src/org/briarproject/api/StringMap.java
Normal file
29
briar-api/src/org/briarproject/api/StringMap.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package org.briarproject.api;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
abstract class StringMap extends Hashtable<String, String> {
|
||||
|
||||
private static final long serialVersionUID = 2497176435908100448L;
|
||||
|
||||
protected StringMap(Map<String, String> m) {
|
||||
super(m);
|
||||
}
|
||||
|
||||
protected StringMap() {
|
||||
super();
|
||||
}
|
||||
|
||||
public boolean getBoolean(String key, boolean defaultValue) {
|
||||
String s = get(key);
|
||||
if(s == null) return defaultValue;
|
||||
if("true".equals(s)) return true;
|
||||
if("false".equals(s)) return false;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void putBoolean(String key, boolean value) {
|
||||
put(key, String.valueOf(value));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user