Coverage Report - org.seasar.teeda.core.config.faces.assembler.impl.DefaultComponentAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultComponentAssembler
100%
15/15
100%
2/2
1.333
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 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,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package org.seasar.teeda.core.config.faces.assembler.impl;
 17  
 
 18  
 import java.util.Iterator;
 19  
 import java.util.Map;
 20  
 
 21  
 import javax.faces.application.Application;
 22  
 
 23  
 import org.seasar.teeda.core.config.faces.assembler.ComponentAssembler;
 24  
 import org.seasar.teeda.core.config.faces.element.ComponentElement;
 25  
 import org.seasar.teeda.core.util.ApplicationUtil;
 26  
 import org.seasar.teeda.core.util.IteratorUtil;
 27  
 
 28  
 /**
 29  
  * @author shot
 30  
  */
 31  
 public class DefaultComponentAssembler extends ComponentAssembler {
 32  
 
 33  
     private Application application_;
 34  
 
 35  
     public DefaultComponentAssembler(Map components) {
 36  3
         super(components);
 37  3
     }
 38  
 
 39  
     protected void setupBeforeAssemble() {
 40  3
         application_ = ApplicationUtil.getApplicationFromFactory();
 41  3
     }
 42  
 
 43  
     public void assemble() {
 44  3
         String componentType = null;
 45  3
         String componentClassName = null;
 46  3
         ComponentElement component = null;
 47  3
         for (Iterator itr = IteratorUtil.getEntryIterator(getComponents()); itr
 48  5
                 .hasNext();) {
 49  2
             Map.Entry entry = (Map.Entry) itr.next();
 50  2
             componentType = (String) entry.getKey();
 51  2
             component = (ComponentElement) entry.getValue();
 52  2
             componentClassName = component.getComponentClass();
 53  2
             application_.addComponent(componentType, componentClassName);
 54  
         }
 55  3
     }
 56  
 
 57  
 }