Hi All,
I have a doubt regarding properties file from which I am reading some
key-values. Now I have few different keys (4-5) having same value .e.g.
key1=value1
key2=value1
key3=value1
key4=value1
key5=value1
Now I need to read these keys from different places and I also need to
update the value to say 'value2' for all the keys e.g.
key1=value2
key2=value2
key3=value2
key4=value2
key5=value2
Now, since i need to update the values of all the keys, I am thinking
of having another key-value pair (e.g. key=value1) in the same property
file, and using the value of this key as value for all the keys
displayed above. So that when I update the value of this key (
key=value2), I dont need to update the values of all the keys, since
those keys will be reading the values from this key's value.
I hope i am clear with this explanation.... ;-)
My first question is, 'IS IT POSSIBLE' ???
If yes, then how????
Thanks in advance
Inder Jeet Singh
Andrew McDonagh - 17 Apr 2006 08:32 GMT
> Hi All,
>
[quoted text clipped - 29 lines]
> Thanks in advance
> Inder Jeet Singh
Possible and most appropriate.
So you currently have
Key1 = value1
Key2 = A shared value
SomeOtherKey = A shared value
...
but its better to have
Key1 = value1
Key2 = SharedValue
SomeOtherKey = SharedValue
SharedValue = A shared value
...
Here the value of Key2 & SomeOtherKey is the name of another property
(SharedValue)
This other property is where the shared value is stored.
Pseudo code:
String valueOfKey2 = getProperty("key2);
String sharedValue = getProperty("valueOfKey2");
system.out.println(sharedValue);
--------------
on std out we'd see:
A shared value