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??
精彩评论