Coverage Report - org.apache.tapestry5.internal.parser.DTDToken
 
Classes in this File Line Coverage Branch Coverage Complexity
DTDToken
89%
8/9
N/A
0
 
 1  
 // Copyright 2007 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  
  * Represents the presence of a Document Type declaration within a template. The Document type declaration will be
 21  
  * output to the client. In the event that multiple declarations are encountered (a page and one or more nested
 22  
  * components all declare a document type), the first document type declared will be used.
 23  
  */
 24  
 public class DTDToken extends TemplateToken
 25  
 {
 26  
     private final String name;
 27  
 
 28  
     private final String publicId;
 29  
 
 30  
     private final String systemId;
 31  
 
 32  
     public DTDToken(String name, String publicId, String systemId, Location location)
 33  
     {
 34  36
         super(TokenType.DTD, location);
 35  
 
 36  36
         this.name = name;
 37  36
         this.publicId = publicId;
 38  36
         this.systemId = systemId;
 39  36
     }
 40  
 
 41  
     /**
 42  
      * Returns the doctype name (the name of the document root element)
 43  
      */
 44  
     public String getName()
 45  
     {
 46  321
         return name;
 47  
     }
 48  
 
 49  
     /**
 50  
      * Returns the public identifier of the DTD
 51  
      */
 52  
     public String getPublicId()
 53  
     {
 54  321
         return publicId;
 55  
     }
 56  
 
 57  
     /**
 58  
      * Returns the system identifier of the DTD
 59  
      */
 60  
     public String getSystemId()
 61  
     {
 62  321
         return systemId;
 63  
     }
 64  
 
 65  
     @Override
 66  
     public String toString()
 67  
     {
 68  0
         return String.format("DTD[name=%s; publicId=%s; systemId=%s]", name, publicId, systemId);
 69  
     }
 70  
 }