/** * Create an instance of DefaultInternalConfiguration, loading values from a resource named "resourceName". This * constructor is provided purely for testing purposes. Application code should always use the * {@link Config#getInstance()} method. * * @param resourceName the name of the resource to load (from the classloader, working or home directory) */ protected DefaultInternalConfiguration(final String resourceName) { initialiseInstanceVariables(); loadTop(resourceName); // Now perform variable substitution. do { } while (substitute()); }
/** * Loading of "top level" resources is different to the general recursive case, since it is only at the top level * that we check for the includeAfter parameter. * * @param resourceName the path of the resource to load from. */ @SuppressWarnings("checkstyle:emptyblock") private void loadTop(final String resourceName) { try { resources.push(resourceName); load(resourceName); // Now check for INCLUDE_AFTER resources String includes = get(INCLUDE_AFTER); if (includes != null) { // First, do substitution on the INCLUDE_AFTER do { } while (substitute(INCLUDE_AFTER)); // Now split and process String[] includeAfter = getString(INCLUDE_AFTER).split(","); backing.remove(INCLUDE_AFTER); for (String after : includeAfter) { loadTop(after); } } } finally { resources.pop(); } }