Coverage Report - javax.faces.view.facelets.TagHandler
 
Classes in this File Line Coverage Branch Coverage Complexity
TagHandler
0%
0/11
0%
0/2
1.5
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package javax.faces.view.facelets;
 20  
 
 21  
 /**
 22  
  * Foundation class for FaceletHandlers associated with markup in a Facelet document.
 23  
  */
 24  
 public abstract class TagHandler implements FaceletHandler
 25  
 {
 26  
     protected final String tagId;
 27  
 
 28  
     protected final Tag tag;
 29  
 
 30  
     protected final FaceletHandler nextHandler;
 31  
 
 32  
     public TagHandler(TagConfig config)
 33  0
     {
 34  0
         this.tagId = config.getTagId();
 35  0
         this.tag = config.getTag();
 36  0
         this.nextHandler = config.getNextHandler();
 37  0
     }
 38  
 
 39  
     /**
 40  
      * Utility method for fetching the appropriate TagAttribute
 41  
      * 
 42  
      * @param localName
 43  
      *            name of attribute
 44  
      * @return TagAttribute if found, otherwise null
 45  
      */
 46  
     protected final TagAttribute getAttribute(String localName)
 47  
     {
 48  0
         return this.tag.getAttributes().get(localName);
 49  
     }
 50  
 
 51  
     /**
 52  
      * Utility method for fetching a required TagAttribute
 53  
      * 
 54  
      * @param localName
 55  
      *            name of the attribute
 56  
      * @return TagAttribute if found, otherwise error
 57  
      * @throws TagException
 58  
      *             if the attribute was not found
 59  
      */
 60  
     protected final TagAttribute getRequiredAttribute(String localName) throws TagException
 61  
     {
 62  0
         TagAttribute attr = this.getAttribute(localName);
 63  0
         if (attr == null)
 64  
         {
 65  0
             throw new TagException(this.tag, "Attribute '" + localName + "' is required");
 66  
         }
 67  
         
 68  0
         return attr;
 69  
     }
 70  
 
 71  
     /**
 72  
      * {@inheritDoc}
 73  
      */
 74  
     @Override
 75  
     public String toString()
 76  
     {
 77  0
         return this.tag.toString();
 78  
     }
 79  
 }