/** * 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); } return answer; }