- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
Encrypted
If a value starts with a
Properties.If a value starts with a
~ (tilde), the remainder of the string is considered to be
encrypted by the application-specific Cryptor.
If an unencrypted value starts with a ~, it must be escaped with a backslash.- See Also:
-
Field Summary
Fields inherited from class java.util.Properties
defaults -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty property list with no default values.EncryptedProperties(int initialCapacity) Creates an empty property list with no default values, and with an initial size accommodating the specified number of elements without the need to dynamically resize.EncryptedProperties(Properties defaults) Creates an empty property list with the specified defaults. -
Method Summary
Modifier and TypeMethodDescriptionclone()getProperty(String key) Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked.char[]getPropertyAsChars(String key) Gets the property as a character array.
Same asgetProperty(String), but returns an array.char[]getPropertyAsChars(String key, char[] defaults) Gets the property as a character array with a default value.getPropertyBlunt(String key) Gets the original value of the property.
If the value is encrypted, the encrypted value will be returned.voidsetEncryptedProperty(String key, char[] value) Sets the property char array and stores it encrypted, if a Cryptor is available.voidsetEncryptedProperty(String key, String value) Sets the property string and stores it encrypted, if a Cryptor is available.Methods inherited from class java.util.Properties
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, getProperty, hashCode, isEmpty, keys, keySet, list, list, load, load, loadFromXML, merge, propertyNames, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, save, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, toString, values
-
Constructor Details
-
EncryptedProperties
public EncryptedProperties()Creates an empty property list with no default values. -
EncryptedProperties
public EncryptedProperties(int initialCapacity) Creates an empty property list with no default values, and with an initial size accommodating the specified number of elements without the need to dynamically resize.- Parameters:
initialCapacity- theEncryptedPropertieswill be sized to accommodate this many elements- Throws:
IllegalArgumentException- if the initial capacity is less than zero.
-
EncryptedProperties
Creates an empty property list with the specified defaults.- Parameters:
defaults- the defaults.
-
-
Method Details
-
clone
- Overrides:
clonein classProperties
-
getProperty
Searches for the property with the specified key in this property list.
If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returnsnullif the property is not found.If the property is encrypted, it will be returned decrypted.
- Overrides:
getPropertyin classProperties- Parameters:
key- the property key- Returns:
- the value in this property list with the specified key value
- See Also:
-
getPropertyBlunt
Gets the original value of the property.
If the value is encrypted, the encrypted value will be returned.- Parameters:
key- the property key- Returns:
- the value, null if no such key
-
getPropertyAsChars
Gets the property as a character array.
Same asgetProperty(String), but returns an array. In case the value was encrypted, the decrypted array can be erased by the application after use.- Parameters:
key- the property key- Returns:
- the value as a character array or null if no such key
-
getPropertyAsChars
Gets the property as a character array with a default value.- Parameters:
key- the property keydefaults- the default value- Returns:
- the value as a character array or null if no such key
-
setEncryptedProperty
Sets the property string and stores it encrypted, if a Cryptor is available.- Parameters:
key- the property keyvalue- the unencrypted value
-
setEncryptedProperty
Sets the property char array and stores it encrypted, if a Cryptor is available.- Parameters:
key- the property keyvalue- the unencrypted value
-