DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=34103>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=34103 ------- Additional Comments From [EMAIL PROTECTED] 2005-03-21 21:48 ------- (In reply to comment #3) > Oliver, what about renaming this method into getScalar() or toScalar() and > move > it to ConfigurationUtils or PropertyConverter ? It would extract the first > element of the specified list or array. Then we would replace: > > Object value = resolveContainerStore(key); > > with: > > Object value = PropertyConverter.toScalar(getProperty(key)); > > I may have to think a bit about this suggestion. To be honest I don't like the fix for resolveContainerStore() (the bunch of if-else-statements) very much. What about the following approach: I know we once removed that old getPropertyDirect() method, but when I was thinking about interpolation, I had the idea of introducing two new methods in AbstractConfiguration like the following: protected Object getSingleProperty(String key); protected abstract List getMultipleProperty(String key); Then scalar getter methods like getString() would call the former and getters for lists and arrays would use the latter. There could also be a default implementation for getSingleProperty() which calls getMultipleProperty() and returns either null or the first element. One big advantage is that properties with multiple values are always treated as lists. So we don't need a bunch of if-statements for conversions, but getter methods for arrays could obtain their values directly from the list. So with this approach it is in the responsibility of a concrete Configuration implementation to store its properties in a way that multiple values for a property can be returned as a list. But with our current implementation (and especially the way AbstractConfiguration.addProperty() is implemented) this is no problem, it should be already the case. It would be problematic if somebody calls an addPropertyDirect() implementation in a subclass with a complex value, but we could add a warning in the javadocs that this is not legal. Well, in short what I try to say is that we should distinguish only between two types of properties: scalars and lists. Other stuff like arrays should be converted to a list when it is added (which is already done by addProperty). -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
