: I'll make it using a semi column (;) as a separator in the property
file,
: shouldn't be used too often. Please tell me if I should use something
else.

As i said, i don't really have a lot of experience with ResourceBundles,
but from what i can tell, i think you should just use getStringArray and
trust whatever list comes back (you get a 0 or 1 item list when using a
Properties file right?)


Unfortunately, no. If  Iuse getStringArray while using a
PropertyResourceBundle to backup the ResourceBundle, getStringArray(key)
give a classCastException, as it is just a Wrapper for : (String[])
getObject(key).

Worse, I tried implementing a ListResourceBundle and I also get a
classCastException on getStringArray()

the level of abstraction you have is with the ResourceBundle API -- not
the Properties API, so you shouldn't assume that your users are providing
a PropertiesResourfceBundle in which you can/need-to split the strings you
get -- trust that the getStringAttary method does the right thing, most
people wll use properties files that return single values, and if anyone
wants multiple values they can write their own class implimenting
ResourceBundle which returns multiplevalues.


Knowing what I said previously, should I still call getStringArray, catch
the exception and there use getString. Seems costly to me, as most will
probably a PropertiesResourceBundle to store values. What do you think?

if you *really* want to support multiple values in Properties fields ...
have a key which if set denotes the string value that all other values
should be split on, if not set, then no splitting is done (that way you
don't have to worry that you might pick a "split character" which winds up
being important to someone.


That's right, even if there aren't many character left that don't have a
meaning.

Patrick

Reply via email to