commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Orciuch" <morci...@apache.org>
Subject [CONFIGURATION] Handling of non-string properties occuring multiple times
Date Fri, 20 Dec 2002 22:15:20 GMT
Currently the string based properties are handled as follows:

foo.bar = aaa
foo.bar = bbb

Configuration object returns "aaa" when using the following call:
getString("foo.bar"). However, in this scenario:

foo.bar = 1
foo.bar = 2

... calling getInt("foo.bar") will cause ClassCastException because multiple
instances of the same property are put in a Container object.

I propose that non-string properties (such as int, long, double, float,
byte) are handled the same way as strings. This is useful if you want to
keep the original property file intact and include it in a custom property
file:

site.properties:
================
...
services.TemplateService.layout.cache.size=20
...
include = TurbineResources.properties

TurbineResources.properties:
============================
...
services.TemplateService.layout.cache.size=10

In the above scenario, call to
getInt("services.TemplateService.layout.cache.size") should return 20 rather
than throw a ClassCastException. Attached patch implements my proposal.

Best regards,

Mark Orciuch - morciuch@apache.org
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/

Mime
View raw message