Coverage Report - org.simpleframework.xml.stream.Attribute
 
Classes in this File Line Coverage Branch Coverage Complexity
Attribute
N/A
N/A
1
 
 1  
 /*
 2  
  * Attribute.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  
 /**
 22  
  * The <code>Attribute</code> interface represents an attribute that
 23  
  * is associated with an event node. An attribute is required to 
 24  
  * provide the name and value for the attribute, and optionally the
 25  
  * namespace reference and prefix. For debugging purposes the source
 26  
  * object from the internal XML provider can be returned also.
 27  
  * 
 28  
  * @author Niall Gallagher
 29  
  *
 30  
  * @see org.simpleframework.xml.stream.EventNode
 31  
  */
 32  
 interface Attribute {
 33  
    
 34  
    /**
 35  
     * This provides the name of the attribute. This should be the
 36  
     * name of the XML attribute without any namespace prefix. If
 37  
     * the name begins with "xml" then this attribute is reserved.
 38  
     * according to the namespaces for XML 1.0 specification.
 39  
     * 
 40  
     * @return this returns the name of this attribute object
 41  
     */
 42  
    String getName();
 43  
    
 44  
    /**
 45  
     * This returns the value of the event. Typically this will be
 46  
     * the text value that the attribute contains. If the attribute
 47  
     * does not contain a value then this returns null. 
 48  
     * 
 49  
     * @return this returns the value represented by this attribute
 50  
     */
 51  
    String getValue();
 52  
    
 53  
    /**
 54  
     * This is used to acquire the namespace reference that this 
 55  
     * attribute is in. A namespace is normally associated with an
 56  
     * attribute if that attribute is prefixed with a known token.
 57  
     * If there is no prefix then this will return null.
 58  
     * 
 59  
     * @return this provides the associated namespace reference
 60  
     */
 61  
    String getReference();
 62  
    
 63  
    /**
 64  
     * This is used to acquire the namespace prefix associated with
 65  
     * this attribute. A prefix is used to qualify the attribute
 66  
     * within a namespace. So, if this has a prefix then it should
 67  
     * have a reference associated with it.
 68  
     * 
 69  
     * @return this returns the namespace prefix for the attribute
 70  
     */
 71  
    String getPrefix();
 72  
    
 73  
    /**
 74  
     * This is used to return the source of the attribute. Depending 
 75  
     * on which provider was selected to parse the XML document an
 76  
     * object for the internal parsers representation of this will
 77  
     * be returned. This is useful for debugging purposes.
 78  
     * 
 79  
     * @return this will return the source object for this event
 80  
     */
 81  
    Object getSource();
 82  
    
 83  
    /**
 84  
     * This returns true if the attribute is reserved. An attribute
 85  
     * is considered reserved if it begins with "xml" according to 
 86  
     * the namespaces in XML 1.0 specification. Such attributes are
 87  
     * used for namespaces and other such details.
 88  
     *
 89  
     * @return this returns true if the attribute is reserved
 90  
     */
 91  
    boolean isReserved();
 92  
 }