Coverage Report - org.apache.tapestry5.internal.parser.AttributeToken
 
Classes in this File Line Coverage Branch Coverage Complexity
AttributeToken
67%
8/12
0%
0/2
0
 
 1  
 // Copyright 2006 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry5.internal.parser;
 16  
 
 17  
 import org.apache.tapestry5.ioc.Location;
 18  
 
 19  
 /**
 20  
  * Stores an attribute/value pair (as part of an XML element).
 21  
  */
 22  
 public class AttributeToken extends TemplateToken
 23  
 {
 24  
     private final String namespaceURI;
 25  
 
 26  
     private final String name;
 27  
 
 28  
     private final String value;
 29  
 
 30  
     public AttributeToken(String namespaceURI, String name, String value, Location location)
 31  
     {
 32  1840
         super(TokenType.ATTRIBUTE, location);
 33  
 
 34  1840
         this.namespaceURI = namespaceURI;
 35  1840
         this.name = name;
 36  1840
         this.value = value;
 37  1840
     }
 38  
 
 39  
     /**
 40  
      * Returns local name for the attribute.
 41  
      */
 42  
     public String getName()
 43  
     {
 44  22873
         return name;
 45  
     }
 46  
 
 47  
     /**
 48  
      * Returns the value for the attribute.
 49  
      */
 50  
     public String getValue()
 51  
     {
 52  23619
         return value;
 53  
     }
 54  
 
 55  
     /**
 56  
      * Returns the namespace URI containing the attribute, or the empty string for the default namespace.
 57  
      */
 58  
     public String getNamespaceURI()
 59  
     {
 60  21557
         return namespaceURI;
 61  
     }
 62  
 
 63  
     @Override
 64  
     public String toString()
 65  
     {
 66  0
         StringBuilder builder = new StringBuilder("Attribute[");
 67  
 
 68  0
         if (namespaceURI.length() > 0) builder.append(namespaceURI).append(" ");
 69  
 
 70  0
         builder.append(name).append("=").append(value).append("]");
 71  
 
 72  0
         return builder.toString();
 73  
     }
 74  
 }