Coverage Report - org.simpleframework.xml.stream.EventToken
 
Classes in this File Line Coverage Branch Coverage Complexity
EventToken
36%
4/11
N/A
1
 
 1  
 /*
 2  
  * EventToken.java January 2010
 3  
  *
 4  
  * Copyright (C) 2010, Niall Gallagher <niallg@users.sf.net>
 5  
  *
 6  
  * Licensed under the Apache License, Version 2.0 (the "License");
 7  
  * you may not use this file except in compliance with the License.
 8  
  * 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, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 15  
  * implied. See the License for the specific language governing 
 16  
  * permissions and limitations under the License.
 17  
  */
 18  
 
 19  
 package org.simpleframework.xml.stream;
 20  
 
 21  
 import java.util.Iterator;
 22  
 
 23  
 /**
 24  
  * The <code>EventToken</code> object is used to represent an event
 25  
  * that has been extracted from the XML document. Events provide a
 26  
  * framework neutral way to represent a token from the source XML.
 27  
  * It provides the name and value of the event, if applicable, and
 28  
  * also provides namespace information. Some nodes will have 
 29  
  * associated <code>Attribute</code> objects, typically these will 
 30  
  * be the XML element events. Also, if available, the event will 
 31  
  * provide the line number the event was encountered in the XML.
 32  
  * 
 33  
  * @author Niall Gallagher
 34  
  */
 35  5341223
 abstract class EventToken implements EventNode  {
 36  
 
 37  
    /**
 38  
     * This is used to provide the line number the XML event was
 39  
     * encountered at within the XML document. If there is no line
 40  
     * number available for the node then this will return a -1.
 41  
     * 
 42  
     * @return this returns the line number if it is available
 43  
     */
 44  
    public int getLine() {
 45  0
       return -1;
 46  
    }
 47  
 
 48  
    /**
 49  
     * This provides the name of the event. Typically this will be
 50  
     * the name of an XML element if the event represents an element.
 51  
     * If however the event represents a text token or an element
 52  
     * close token then this method may return null for the name.
 53  
     * 
 54  
     * @return this returns the name of this event or null
 55  
     */
 56  
    public String getName() {
 57  0
       return null;
 58  
    }
 59  
 
 60  
    /**
 61  
     * This returns the value of the event. Typically this will be
 62  
     * the text value that the token contains. If the event does 
 63  
     * not contain a value then this returns null. Only text events
 64  
     * are required to produce a value via this methods. 
 65  
     * 
 66  
     * @return this returns the value represented by this event
 67  
     */
 68  
    public String getValue() {
 69  0
       return null;
 70  
    }
 71  
    
 72  
    /**
 73  
     * This is used to acquire the namespace reference that this 
 74  
     * node is in. A namespace is normally associated with an XML
 75  
     * element or attribute, so text events and element close events
 76  
     * are not required to contain any namespace references. 
 77  
     * 
 78  
     * @return this will provide the associated namespace reference
 79  
     */
 80  
    public String getReference() {
 81  0
       return null;
 82  
    }
 83  
    
 84  
    /**
 85  
     * This is used to acquire the namespace prefix associated with
 86  
     * this node. A prefix is used to qualify an XML element or
 87  
     * attribute within a namespace. So, if this represents a text
 88  
     * event then a namespace prefix is not required.
 89  
     * 
 90  
     * @return this returns the namespace prefix for this event
 91  
     */
 92  
    public String getPrefix() {
 93  0
       return null;
 94  
    }
 95  
    
 96  
    /**
 97  
     * This is used to return the source of the event. Depending on
 98  
     * which provider was selected to parse the XML document an
 99  
     * object for the internal parsers representation of the event
 100  
     * will be returned. This is useful for debugging purposes.
 101  
     * 
 102  
     * @return this will return the source object for this event
 103  
     */
 104  
    public Object getSource() {
 105  0
       return null;
 106  
    }
 107  
 
 108  
    /**
 109  
     * This is used to acquire the <code>Attribute</code> objects
 110  
     * that are associated with this event. Attributes are typically
 111  
     * associated wit start events. So, if the node is not a start
 112  
     * event his may return a null value or an empty iterator.
 113  
     * 
 114  
     * @return this returns an iterator for iterating attributes
 115  
     */
 116  
    public Iterator<Attribute> iterator() {
 117  0
       return null;
 118  
    }
 119  
 
 120  
    /**
 121  
     * This is true when the node represents an element close. Such
 122  
     * events are required by the core reader to determine if a 
 123  
     * node is still in context. This helps to determine if there
 124  
     * are any more children to be read from a specific node.
 125  
     * 
 126  
     * @return this returns true if the event is an element close
 127  
     */
 128  
    public boolean isEnd() {
 129  3530511
       return false;
 130  
    }
 131  
 
 132  
    /**
 133  
     * This is true when the node represents a new element. This is
 134  
     * the core event type as it contains the element name and any
 135  
     * associated attributes. The core reader uses this to compose
 136  
     * the input nodes that are produced.
 137  
     * 
 138  
     * @return this returns true if the event represents an element
 139  
     */
 140  
    public boolean isStart() {
 141  2523259
       return false;
 142  
    }
 143  
 
 144  
    /**
 145  
     * This is true when the node represents a text token. Text 
 146  
     * tokens are required to provide a value only. So namespace
 147  
     * details and the node name will typically return null.
 148  
     *  
 149  
     * @return this returns true if this represents text  
 150  
     */
 151  
    public boolean isText() {
 152  1008074
       return false;
 153  
    }
 154  
 }