开发者

Groovy Properties list from HashTable

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜