how can i read from properties every thing start with foo.* ?
Meir Yan
Ranch Hand
Joined: Apr 27, 2006
Posts: 597
posted
0
Hello all i have big properties file that i use it as configuration file there is section in my application that uses only some portion of the properties file this properties are set into Properties class
all the key's that start with foo.* for example ... foo.name foo.age foo.lastname ....
how can i set my Properties class with only keys that start with foo? and not the others? the getProperty("foo.*") dont work....
so i could add different configurations keys based on the foo.* whiteout changing the code
so in code i will know that the Properties object im building will be set from all the keys starting with foo.*
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
posted
0
There is a getKeys() method. Could you iterate the keys and match on startsWith or a RegEx or something?
I need to look into this myself. I copied some code years ago that requires tags with sequence numbers, eg foo1, foo2, foo3, etc. I iterate through numbers until I get a not found. Ick.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: how can i read from properties every thing start with foo.* ?