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  /**
19   * <p>
20   * Definition of an interface for objects that perform some kind of
21   * initialization on beans that are managed by a
22   * <code>{@link BeanContext}</code>.
23   * </p>
24   * <p>
25   * The <code>{@link DependencyProvider}</code> interface allows adding an
26   * arbitrary number of objects implementing this interface. These objects will
27   * then be invoked after all beans affected by the current transaction have been
28   * created. This way certain cyclic dependencies can be resolved.
29   * </p>
30   *
31   * @author Oliver Heger
32   * @version $Id: BeanInitializer.java 205 2012-01-29 18:29:57Z oheger $
33   */
34  public interface BeanInitializer
35  {
36      /**
37       * Performs the desired initialization. It is up to a concrete
38       * implementation, which actions are performed here. When this method is
39       * called all beans affected by the current transaction have been created
40       * (if possible). Some of them might not have been initialized yet. Note
41       * that this method is called in any case, even if the current transaction
42       * fails for some reason.
43       *
44       * @param dependencyProvider the dependency provider
45       */
46      void initialize(DependencyProvider dependencyProvider);
47  }