Author: tchemit Date: 2013-03-15 13:43:07 +0100 (Fri, 15 Mar 2013) New Revision: 2532 Url: http://nuiton.org/projects/nuiton-utils/repository/revisions/2532 Log: fixes #2600: [ApplicationConfig] Add more methods on ApplicationConfigHelper Modified: trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfigHelper.java Modified: trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfigHelper.java =================================================================== --- trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfigHelper.java 2013-03-13 13:48:55 UTC (rev 2531) +++ trunk/nuiton-config/src/main/java/org/nuiton/util/config/ApplicationConfigHelper.java 2013-03-15 12:43:07 UTC (rev 2532) @@ -191,16 +191,53 @@ * @return the set of options key not to store in the config file * @see ConfigOptionDef#isFinal() * @see ConfigOptionDef#isTransient() - * @since 2.6.7 + * @since 2.6.11 */ public static Set<String> getTransientOrFinalOptionKey(Set<ApplicationConfigProvider> providers) { Set<String> result = new HashSet<String>(); - for (ConfigOptionDef def : getTransientOptions(providers)) { - result.add(def.getKey()); + result.addAll(getTransientOptionKeys(providers)); + result.addAll(getFinalOptionKeys(providers)); + return result; + } + + /** + * Gets all transient options keys from the given providers. + * + * @param providers providers to inspect + * @return the set of all options key that are transient + * @see ConfigOptionDef#isTransient() + * @since 2.6.11 + */ + public static Set<String> getTransientOptionKeys(Set<ApplicationConfigProvider> providers) { + Set<String> result = new HashSet<String>(); + for (ApplicationConfigProvider provider : providers) { + for (ConfigOptionDef def : provider.getOptions()) { + if (def.isTransient()) { + result.add(def.getKey()); + } + } } - for (ConfigOptionDef def : getFinalOptions(providers)) { - result.add(def.getKey()); + return result; + } + + /** + * Gets all final options keys from the given providers. + * + * @param providers providers to inspect + * @return the set of all options keys that are final + * @see ConfigOptionDef#isTransient() + * @since 2.6.7 + */ + public static Set<String> getFinalOptionKeys(Set<ApplicationConfigProvider> providers) { + Set<String> result = new HashSet<String>(); + for (ApplicationConfigProvider provider : providers) { + for (ConfigOptionDef def : provider.getOptions()) { + if (def.isFinal()) { + result.add(def.getKey()); + } + } } return result; } + }
participants (1)
-
tchemit@users.nuiton.org