I need to get the values from a properties file. I am doing it like this:
for (String key : propsFile.stringPropertyNames()) {
String value = propsFile.getProperty(key);
//Now I want to get value as its appropiated generic type object,
//since later I will map the properties file into a TreeMap<Key, Object>,
//where Object should be the value as a proper generic type object,
//or a custom one based on developer opinion.
}
(value
might be sometimes "asf", other times "949", other times "true"...)
How could I convert the string value
to a new generic type object based on the kind of data retrieved? Or some way or library to do this directly when getting the properties by the key, with the option of defining custom types?
Aucun commentaire:
Enregistrer un commentaire