View Javadoc

1   /*
2    * Copyright 2006-2016 The JGUIraffe Team.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License")
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.jguiraffe.di;
17  
18  import java.util.EventListener;
19  
20  /**
21   * <p>
22   * Definition of an interface for objects that are interested in the creation of
23   * beans by a {@link BeanContext}.
24   * </p>
25   * <p>
26   * Objects implementing this interface can be registered at a {@code
27   * BeanContext} as <em>bean creation listeners</em>. They will then be notified
28   * whenever a new bean is created by the context. This is a very powerful means
29   * of intercepting the bean creation process. For instance, a listener can
30   * perform enhanced initialization on certain types of beans and inject property
31   * values that are known at runtime only.
32   * </p>
33   *
34   * @author Oliver Heger
35   * @version $Id: BeanCreationListener.java 205 2012-01-29 18:29:57Z oheger $
36   */
37  public interface BeanCreationListener extends EventListener
38  {
39      /**
40       * Notifies this listener about the creation of a new bean. The passed in
41       * event object contains all information available about the new bean.
42       *
43       * @param event the event with information about the bean creation
44       */
45      void beanCreated(BeanCreationEvent event);
46  }