Author: bpoussin Date: 2008-08-22 22:48:21 +0000 (Fri, 22 Aug 2008) New Revision: 1057 Modified: trunk/lutinutil/src/main/java/org/codelutin/util/ApplicationConfig.java Log: - ajout de getOptionStartsWith pour recupere toutes les options commencant par une chaine Modified: trunk/lutinutil/src/main/java/org/codelutin/util/ApplicationConfig.java =================================================================== --- trunk/lutinutil/src/main/java/org/codelutin/util/ApplicationConfig.java 2008-08-21 16:25:08 UTC (rev 1056) +++ trunk/lutinutil/src/main/java/org/codelutin/util/ApplicationConfig.java 2008-08-22 22:48:21 UTC (rev 1057) @@ -291,11 +291,11 @@ protected Properties jvm = new Properties(env); protected Properties line = new Properties(jvm); protected Properties options = new Properties(line); - + protected Map<String, CacheItem> cacheOption = new HashMap<String, ApplicationConfig.CacheItem>(); protected Map<Class, Object> cacheAction = new HashMap<Class, Object>(); - + /** contient apres l'appel de parse, la liste des arguments non utilises */ protected List<String> unparsed = new ArrayList<String>(); protected Map<Integer, List<Action>> actions = new HashMap<Integer, List<Action>>(); @@ -524,6 +524,25 @@ } /** + * Permet de recuperer l'ensemble des options commencant par une certaine + * chaine + * + * @param key debut de cle a recuperer + * @return + */ + public Properties getOptionStartsWith(String prefix) { + Properties result = new Properties(); + + for (String key : options.stringPropertyNames()) { + if(key.startsWith(prefix)) { + result.setProperty(key, options.getProperty(key)); + } + } + + return result; + } + + /** * get option value as typed value * * @param clazz type of object wanted as return type