Package net.sf.okapi.common
Class UserConfiguration
- java.lang.Object
-
- java.util.Dictionary<K,V>
-
- java.util.Hashtable<Object,Object>
-
- java.util.Properties
-
- net.sf.okapi.common.UserConfiguration
-
- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
public class UserConfiguration extends Properties
Simple class to store user-specific properties of an application in the user folder.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.Properties
defaults
-
-
Constructor Summary
Constructors Constructor Description UserConfiguration()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleangetBoolean(String key)Gets a boolean property value.booleangetBoolean(String key, boolean defaultValue)Gets a boolean property value possibly set to a default value.intgetInteger(String key)Gets an integer property.voidload(String appName)Load the user-specific application properties.voidsave(String appName, String version)Save the user-specific application properties.ObjectsetProperty(String key, boolean value)Sets a boolean property.ObjectsetProperty(String key, int value)Sets an integer property.ObjectsetProperty(String key, String value)-
Methods inherited from class java.util.Properties
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
-
-
-
Method Detail
-
load
public void load(String appName)
Load the user-specific application properties.- Parameters:
appName- the application name.
-
save
public void save(String appName, String version)
Save the user-specific application properties.- Parameters:
appName- the application name.version- the application version, will be used in a comment.
-
setProperty
public Object setProperty(String key, String value)
- Overrides:
setPropertyin classProperties
-
getBoolean
public boolean getBoolean(String key)
Gets a boolean property value.- Parameters:
key- The name of the property.- Returns:
- True if the property exists and is set to "true", false if it does not exists or if it is set to "false".
-
getBoolean
public boolean getBoolean(String key, boolean defaultValue)
Gets a boolean property value possibly set to a default value.- Parameters:
key- the name of the property.defaultValue- the default value.- Returns:
- the value of the property if it exists, or the default value if it does not exist.
-
setProperty
public Object setProperty(String key, boolean value)
Sets a boolean property.- Parameters:
key- The name of the property.value- The new value for the property.- Returns:
- The previous value of the property, or null if the property did not exists yet.
-
getInteger
public int getInteger(String key)
Gets an integer property.- Parameters:
key- The name of the property.- Returns:
- The integer value of the property if it exists, 0 if it does not exists.
-
-