Repository: camel Updated Branches: refs/heads/master 1a347d2d9 -> dd702e612
Add documentation for HierarchicalPropertiesEvaluator Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a16f8152 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a16f8152 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a16f8152 Branch: refs/heads/master Commit: a16f8152c1217726b93f4bfc3837db06855028f7 Parents: 1a347d2 Author: lburgazzoli <[email protected]> Authored: Wed Jul 5 13:51:48 2017 +0200 Committer: lburgazzoli <[email protected]> Committed: Wed Jul 5 13:51:48 2017 +0200 ---------------------------------------------------------------------- .../boot/util/HierarchicalPropertiesEvaluator.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/a16f8152/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java ---------------------------------------------------------------------- diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java index a41effb..fa66a11 100644 --- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java +++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/util/HierarchicalPropertiesEvaluator.java @@ -23,10 +23,22 @@ public final class HierarchicalPropertiesEvaluator { private HierarchicalPropertiesEvaluator() { } + /** + * Determine the value of the "enabled" flag for a hierarchy of properties. + * + * @param environment the environment + * @param prefixes an ordered list of prefixed (less restrictive to more restrictive) + * @return the value of the key `enabled` for most restrictive prefix + */ public static boolean evaluate(Environment environment, String... prefixes) { boolean answer = true; + // Loop over all the prefixes to find out the value of the key `enabled` + // for the most restrictive prefix. for (String prefix : prefixes) { + // evaluate the value of the current prefix using the parent one + // as default value so if the enabled property is not set, the parent + // one is used. answer = isEnabled(environment, prefix, answer); }
