I'm trying to read multiple values using ini4j, the docs say it should be possible with the Options class.
Here is my sample .ini file (./dwarfs.ini)
[dopey]
age = 23
fortuneNumber = 11
fortuneNumber = 33
fortuneNumber = 55
here is the code to read it:
Ini ini = new Ini();
Config conf = new Config();
conf.setMultiOption(true);
ini.setConfig(conf);
ini.load(new FileReader("./dwarfs.ini"));
but fortuneNumber property is just 55 after reading and I'd want it to be an array or a list, anything.
The web presence for the ini4j project contains (among others) very simple tutorials. One of these tutorials explains, how to retrieve multiple values. How could you expect to get a list or an array, when using a fetch method that returns a single reference? Look at the API!
In the tutorial, there is a part explaining multi values:
There is also an example:
In this example, sneezy is a
Section
, but it should also work with anIni
.And just to make it complete: An
Ini
also knows a methodList<V> getAll(Object key)
.