View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.configuration2.builder;
18  
19  import org.apache.commons.configuration2.event.EventListenerList;
20  
21  /**
22   * <p>
23   * Definition of an interface that is evaluated by a {@link ConfigurationBuilder} to initialize event listeners.
24   * </p>
25   * <p>
26   * This interface allows a convenient initialization of a configuration builder with event listeners to be registered at
27   * the managed configuration object. The {@code configure()} method of {@link BasicConfigurationBuilder} checks whether
28   * a parameters object passed to it implements this interface. If this is the case, all event listeners defined by the
29   * object are added to the internal list managed by the builder. They are then automatically registered at the managed
30   * configuration when it is created. When using a corresponding implementation the configuration of event listeners can
31   * be done in the same fluent API style as the other initialization of the configuration builder.
32   * </p>
33   *
34   * @since 2.0
35   */
36  public interface EventListenerProvider {
37      /**
38       * Gets an {@code EventListenerList} object with information about event listener registrations. All listeners
39       * contained in this object are added to the processing {@code ConfigurationBuilder}.
40       *
41       * @return the {@code EventListenerList} with event listener registrations (must not be <b>null</b>)
42       */
43      EventListenerList getListeners();
44  }