/** * Creates a wrapper {@code ImmutableConfiguration} on top of the specified * {@code ConfigurationBuilder}. This implementation delegates to * {@link #createBuilderConfigurationWrapper(Class, ConfigurationBuilder, EventSourceSupport)} * . * * @param <T> the type of the configuration objects returned by this method * @param ifcClass the class of the configuration objects returned by this * method; this must be an interface class and must not be * <b>null</b> * @param builder the wrapped {@code ConfigurationBuilder} (must not be * <b>null</b>) * @return the wrapper configuration * @throws IllegalArgumentException if a required parameter is missing * @throws org.apache.commons.configuration2.ex.ConfigurationRuntimeException if an error * occurs when creating the result {@code ImmutableConfiguration} */ public <T extends ImmutableConfiguration> T createBuilderConfigurationWrapper( final Class<T> ifcClass, final ConfigurationBuilder<? extends T> builder) { return createBuilderConfigurationWrapper(ifcClass, builder, getEventSourceSupport()); }
fetchSupportedInterfaces(ifcClass, evSrcSupport), new BuilderConfigurationWrapperInvocationHandler(builder, evSrcSupport)));
/** * Creates a configuration which wraps the specified builder. * * @param builder the builder * @return the wrapping configuration */ // It is safe to disable any type checks because we manually determine // the interface class to be passed to BuilderConfigurationWrapperFactory @SuppressWarnings({ "unchecked", "rawtypes" }) private Configuration createWrapperConfiguration( final ConfigurationBuilder builder) { final Class<?> configClass = ConfigurationUtils.loadClassNoEx(getConfigurationClass()); final Class ifcClass = HierarchicalConfiguration.class.isAssignableFrom(configClass) ? HierarchicalConfiguration.class : Configuration.class; return (Configuration) BuilderConfigurationWrapperFactory .createBuilderConfigurationWrapper(ifcClass, builder, EventSourceSupport.BUILDER); }