Author: mturk Date: Wed Apr 15 15:08:07 2009 New Revision: 765229 URL: http://svn.apache.org/viewvc?rev=765229&view=rev Log: Make get methods public
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java?rev=765229&r1=765228&r2=765229&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java Wed Apr 15 15:08:07 2009 @@ -51,7 +51,11 @@ return bundle; } - private static String getString(String key, String def) + /** Get resource property value. + * @param key Resource name to get. + * @param def Default value in case <code>key</code> was not found. + */ + public static String get(String key, String def) { String rv = def; if (instance == null) @@ -66,9 +70,13 @@ return rv; } - private static String getString(String key) + /** Get resource property value. + * @param key Resource name to get. In case the propery is not present + * this method returns <code>null</null>. + */ + public static String get(String key) { - return getString(key, null); + return get(key, null); } private static int getInt(String key, int def) Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java?rev=765229&r1=765228&r2=765229&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java (original) +++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java Wed Apr 15 15:08:07 2009 @@ -56,4 +56,10 @@ assertEquals("Value ", 1, l); } + public void testNamedProperties() + throws Exception + { + assertEquals("Value ", "bar", org.apache.commons.runtime.Properties.get("foo", "bar")); + + } }