commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bessie <tbes...@meez.com>
Subject [configuration] Any way to tell with CompositeConfiguration which child Config object a value is derived?
Date Wed, 16 Nov 2011 21:24:10 GMT
I have been trying to use commons-configuration, especially the
CompositeConfiguration object (and have looked into CombinedConfiguration),
and I have a need to be able to ask  "Which child configuration object did
a given key's value derive from?"

I had thought that CompositeConfiguration.getSource() would tell me, but if
we have:

source A:
x.prop1=hello

source B:
x.prop1=goodbye

source DEFAULT:
x.prop1=You didn't set a value

and I call getSource("x.prop1"), I'll get an IllegalArgumentException,
since x.prop1 exists in all 3 child configurations.

What I was hoping for was something that would be consistent with
getProperty("x.prop1"); since that would return the value from "source A"
(since that was where it was first found), I was hoping there'd be some
method that could tell me "in which child configuration was the value you
got found", but there doesn't seem to be any way to do this.

Why is this vital functionality missing?  Or am I missing something in the
documentation?

-- 

Tim Bessie
Meez, Inc.
tbessie@meez.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message