From: <st...@us...> - 2008-08-05 15:00:24
|
Revision: 6885 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=6885&view=rev Author: steve_l Date: 2008-08-05 15:00:19 +0000 (Tue, 05 Aug 2008) Log Message: ----------- SFOS-937 ListUtils tuple methods shoud use <?> as a type instead of <Object> Modified Paths: -------------- trunk/core/smartfrog/src/org/smartfrog/sfcore/utils/ListUtils.java Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/utils/ListUtils.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/utils/ListUtils.java 2008-08-05 14:59:23 UTC (rev 6884) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/utils/ListUtils.java 2008-08-05 15:00:19 UTC (rev 6885) @@ -171,7 +171,7 @@ /** * Convert a property list into a Java properties class - * @param tupleList a list of tuples (must not be null) + * @param tupleList a list of tuples (can be null) * @return a properties object containing name,value pairs. * @throws SmartFrogResolutionException if one of the list entries is not a tuple */ @@ -195,6 +195,28 @@ } /** + * Convert a property list into a Java properties class + * + * @param tupleList a list of tuples (Can be null) + * @return a properties object containing name,value pairs. + * @throws SmartFrogResolutionException if one of the list entries is not a tuple + */ + public static Properties convertToProperties(Vector<Vector<?>> tupleList) throws SmartFrogResolutionException { + Properties properties = new Properties(); + if (tupleList != null) { + for (Vector<?> entry: tupleList) { + if (entry.size() != 2) { + throw new SmartFrogResolutionException(ERROR_WRONG_SIZE + entry); + } + String name = entry.get(0).toString(); + String value = entry.get(1).toString(); + properties.setProperty(name, value); + } + } + return properties; + } + + /** * Extract a string list; everything is * converted to strings in the process * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |