开发者

Groovy Properties list from HashTable

开发者 https://www.devze.com 2023-01-09 15:45 出处:网络
I am setting an external file to hold some persistent variables as Properties() Is there an easy way to list these in the same way that

I am setting an external file to hold some persistent variables as Properties()

Is there an easy way to list these in the same way that

System.Properties()

does?? to produce a list of Properties I h开发者_运维百科ave set.


try using config slurper

http://groovy.codehaus.org/ConfigSlurper


System.Properties() is just an instance of java.util.Properties.

Take a look at the docs: http://download.oracle.com/javase/6/docs/api/java/util/Properties.html


String list
for(Enumeration e = jr.keys();
e.hasMoreElements()
;){list = list + "\n" + e.nextElement()
}
return list.replace('null\n', '')

Is there a more Groovy way to do it??

0

精彩评论

暂无评论...
验证码 换一张
取 消