Coverage Report - org.seasar.teeda.core.config.faces.assembler.impl.DefaultValidatorAssembler
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultValidatorAssembler
100%
12/12
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.ValidatorAssembler;
 24  
 import org.seasar.teeda.core.config.faces.element.ValidatorElement;
 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 DefaultValidatorAssembler extends ValidatorAssembler {
 32  
 
 33  
     private Application application_;
 34  
 
 35  
     public DefaultValidatorAssembler(Map validators) {
 36  3
         super(validators);
 37  3
     }
 38  
 
 39  
     protected void setupBeforeAssemble() {
 40  3
         application_ = ApplicationUtil.getApplicationFromFactory();
 41  3
     }
 42  
 
 43  
     public void assemble() {
 44  3
         for (Iterator itr = IteratorUtil.getEntryIterator(getValidators()); itr
 45  4
                 .hasNext();) {
 46  1
             Map.Entry entry = (Map.Entry) itr.next();
 47  1
             String validatorId = (String) entry.getKey();
 48  1
             ValidatorElement validatorElement = (ValidatorElement) entry
 49  
                     .getValue();
 50  1
             String validatorClass = validatorElement.getValidatorClass();
 51  1
             application_.addValidator(validatorId, validatorClass);
 52  
         }
 53  3
     }
 54  
 
 55  
 }