getting data from ConfigObject
How to get data from this confstruction:
sth {
[
firstname="me"
second="sfdg"
]
[
adress="adfha开发者_运维知识库jkfdh"
]
}
I used ConfigObject but when I get from it keySet it gives me whole list(firstname, secondname,adress) bu I have to separete it. Is any way to get data from only one tab e.g. only "firstname" and "secondname".
As I understand it, you used to have config like:
sth {
firstname="me"
second="sfdg"
adress="adfhajkfdh"
}
but you now want to structure that into columns?
One way this could be done is by structuring each column into a separate property like so:
sth {
column1 {
firstname="me"
second="sfdg"
}
column2 {
adress="adfhajkfdh"
}
}
Or, you could declare another columns property which constains a list of columns (each of which is a list of properties that you want in each column), ie:
sth {
firstname="me"
second="sfdg"
adress="adfhajkfdh"
columns = [ column1:[ 'firstname', 'second' ], column2:[ 'address' ] ]
}
Personally, I prefer the second approach as it should still work with your old code, you don't need to iterate the ConfigObject structure to get all the properties, and properties could be in multiple columns (if this becomes a future requirement)
精彩评论