Package org.jppf.utils
Class AbstractTypedProperties
- All Implemented Interfaces:
Serializable,Cloneable,Map<Object,Object>
- Direct Known Subclasses:
TypedProperties
Extension of the
java.util.Properties class to handle the conversion of string values to other types.- Since:
- 6.0
- Author:
- Laurent Cohen
- See Also:
-
Field Summary
Fields inherited from class java.util.Properties
defaults -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AbstractTypedProperties(Map<?, ?> map) Initialize this object with a set of existing properties. -
Method Summary
Modifier and TypeMethodDescriptionasString()Convert this set of properties into a string.Convert this set of properties into a string.<T extends AbstractTypedProperties>
TfromString(String source) Populate this propertis object from a string source.<T extends AbstractTypedProperties>
TfromString(String source, String delimiter) Populate this properties object from a string source.<T extends AbstractTypedProperties>
TloadAndResolve(Reader reader) Load the properties from the specified reader.voidreset()voidsetDefaults(AbstractTypedProperties defaults) toString()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, setProperty, size, store, store, storeToXML, storeToXML, storeToXML, stringPropertyNames, values
-
Constructor Details
-
AbstractTypedProperties
public AbstractTypedProperties()Default constructor. -
AbstractTypedProperties
Initialize this object with a set of existing properties. This will copy into the present object all map entries such that both key and value are strings.- Parameters:
map- the properties to be copied. No reference to this parameter is kept in this TypedProperties object.
-
-
Method Details
-
loadAndResolve
Load the properties from the specified reader. The properties are first loaded, then includes are resolved, variable substitutions are resolved, and finally scripted values are computed.- Type Parameters:
T- the type of object returned by this method.- Parameters:
reader- the reader to read the properties from.- Returns:
- this
TypedPropertiesobject. - Throws:
IOException- if any error occurs.
-
asString
Convert this set of properties into a string.- Returns:
- a representation of this object as a string.
-
asString
Convert this set of properties into a string.- Parameters:
delimiter- the delimiter between two properties definitions.- Returns:
- a representation of this object as a string.
-
fromString
Populate this propertis object from a string source.- Type Parameters:
T- the type of object returned by this method.- Parameters:
source- the source to read the properties from.- Returns:
- this properties object.
-
fromString
Populate this properties object from a string source.- Type Parameters:
T- the type of object returned by this method.- Parameters:
source- the source to read the properties from.delimiter- the delimiter between two properties definitions.- Returns:
- this properties object.
-
getDefaults
- Returns:
- the default (initial) properties, if any.
-
setDefaults
- Parameters:
defaults- the default (initial) properties, if any.
-
reset
public void reset() -
toString
- Overrides:
toStringin classProperties
-