Coverage Report - org.seasar.teeda.core.util.EmptyElementUtil
 
Classes in this File Line Coverage Branch Coverage Complexity
EmptyElementUtil
70%
7/10
83%
5/6
3.5
 
 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.util;
 17  
 
 18  
 import org.seasar.framework.exception.EmptyRuntimeException;
 19  
 import org.seasar.framework.util.StringUtil;
 20  
 import org.seasar.teeda.core.JsfConstants;
 21  
 
 22  
 /**
 23  
  * @author higa
 24  
  * 
 25  
  */
 26  
 public class EmptyElementUtil implements JsfConstants {
 27  
 
 28  1
     private static final String[] EMPTY_ELEMENT_TAGNAMES = { BASE_ELEM,
 29  
             META_ELEM, LINK_ELEM, FRAME_ELEM, HR_ELEM, BR_ELEM, BASEFONT_ELEM,
 30  
             PARAM_ELEM, IMG_ELEM, AREA_ELEM, INPUT_ELEM, ISINDEX_ELEM, COL_ELEM };
 31  
 
 32  0
     protected EmptyElementUtil() {
 33  0
     }
 34  
 
 35  
     public static boolean isEmptyElement(String tagName) {
 36  159
         if (StringUtil.isEmpty(tagName)) {
 37  0
             throw new EmptyRuntimeException("tagName");
 38  
         }
 39  159
         String name = tagName.toLowerCase();
 40  1842
         for (int i = 0; i < EMPTY_ELEMENT_TAGNAMES.length; ++i) {
 41  1803
             if (EMPTY_ELEMENT_TAGNAMES[i].equals(name)) {
 42  120
                 return true;
 43  
             }
 44  
         }
 45  39
         return false;
 46  
     }
 47  
 }