There is nothing to stop you creating a properties class taking Integers or Booleans (capital I/B) as the “V”s in its map.
But changing the type of a preexisting map means your methods do not maintain the types they are handling nor returning, so they cannot be overridden versions of each other.The second example would require a map taking different types, a Map<String, Integer>.
A getProperty() method will be even harder to implement; you would have several override equivalent versions with different return types, and that won't compile either.
I get the following error messages when compiling:-
The method getProperty(String, String) in the type Properties is not applicable for the arguments (String, boolean)
The method getProperty(String, String) in the type Properties is not applicable for the arguments (String, int)
The method getProperty(String, String) in the type Properties is not applicable for the arguments (String, double)
The original code used a method which is no longer available and I do not have a copy of its code
Why not just convert your int/double/boolean properties to and from String as required? I.e. convert them to String to put them in the properties file, convert them from String when getting them from the properties file.
It's not as if that's a wild and crazy idea, we had to do that with Windows .ini files since about 55 BC.
It has been like that ever since 54BC (“owing to the peculiar Roman method of counting”). It might be a bad idea to maintain all properties as text, but that is what they did in 54BC and it is now very difficult to change to different types. It behaves as a pre‑existing map, whose types you can't now change.
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad: