View Javadoc

1   /*
2    * Copyright 2007-2008 Naoki NOSE.
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 jp.liq.container.component;
17  
18  import java.util.ArrayList;
19  
20  import jp.liq.container.Injector;
21  
22  /**
23   * InjectableComponent のリストです。
24   * {@link #with(Injector)} によって、
25   * 要素であるInjectableComponent すべてに {@link jp.liq.container.Injector} 
26   * を一括設定することができます。
27   * @author nosen
28   */
29  public class InjectableComponentList 
30          extends ArrayList<InjectableComponent<?, ?>> {
31      private static final long serialVersionUID = 9018863287953234480L;
32  
33      /**
34       * 自らのすべての要素に対し、Injectorを設定します
35       * @param injector 設定するInjector
36       * @return 自分自身のインスタンス
37       */
38      public InjectableComponentList with(Injector injector) {
39          for(InjectableComponent<?, ?> ic : this) {
40              ic.with(injector);
41          }
42          return this;
43      }
44  }