Coverage Report - org.simpleframework.xml.stream.EventElement
 
Classes in this File Line Coverage Branch Coverage Complexity
EventElement
83%
5/6
N/A
1
 
 1  
 /*
 2  
  * EventElement.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.ArrayList;
 22  
 
 23  
 /**
 24  
  * The <code>EventElement</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  1803298
 abstract class EventElement extends ArrayList<Attribute> 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  30
       return -1;
 46  
    }
 47  
 
 48  
    /**
 49  
     * This returns the value of the event. Typically this will be
 50  
     * the text value that the token contains. If the event does 
 51  
     * not contain a value then this returns null. Only text events
 52  
     * are required to produce a value via this methods. 
 53  
     * 
 54  
     * @return this returns the value represented by this event
 55  
     */
 56  
    public String getValue() {
 57  0
       return null;
 58  
    }
 59  
 
 60  
    /**
 61  
     * This is true when the node represents an element close. Such
 62  
     * events are required by the core reader to determine if a 
 63  
     * node is still in context. This helps to determine if there
 64  
     * are any more children to be read from a specific node.
 65  
     * 
 66  
     * @return this returns true if the event is an element close
 67  
     */
 68  
    public boolean isEnd() {
 69  1808831
       return false;
 70  
    }
 71  
 
 72  
    /**
 73  
     * This is true when the node represents a new element. This is
 74  
     * the core event type as it contains the element name and any
 75  
     * associated attributes. The core reader uses this to compose
 76  
     * the input nodes that are produced.
 77  
     * 
 78  
     * @return this returns true if the event represents an element
 79  
     */
 80  
    public boolean isStart() {
 81  3612112
       return true;
 82  
    }
 83  
 
 84  
    /**
 85  
     * This is true when the node represents a text token. Text 
 86  
     * tokens are required to provide a value only. So namespace
 87  
     * details and the node name will typically return null.
 88  
     *  
 89  
     * @return this returns true if this represents text  
 90  
     */
 91  
    public boolean isText() {
 92  5564
       return false;
 93  
    }
 94  
 }