org.apache.commons.betwixt.io
Class AbstractBeanWriter.IDElementAttributes

java.lang.Object
  extended byorg.apache.commons.betwixt.io.AbstractBeanWriter.ElementAttributes
      extended byorg.apache.commons.betwixt.io.AbstractBeanWriter.IDElementAttributes
All Implemented Interfaces:
org.xml.sax.Attributes
Enclosing class:
AbstractBeanWriter

private class AbstractBeanWriter.IDElementAttributes
extends AbstractBeanWriter.ElementAttributes

Attributes with generate ID/IDREF attributes //TODO: refactor the ID/REF generation so that it's fixed at introspection and the generators are placed into the Context.

Version:
$Revision: 438373 $
Author:
Jakarta Commons Team

Field Summary
private  java.lang.String idAttributeName
          ID attribute name
private  int idIndex
           
private  java.lang.String idValue
          ID attribute value
private  int length
           
private  boolean matchingAttribute
           
 
Constructor Summary
(package private) AbstractBeanWriter.IDElementAttributes(ElementDescriptor descriptor, Context context, java.lang.String idAttributeName, java.lang.String idValue)
          Construct attributes for element and context.
 
Method Summary
 int getIndex(java.lang.String qName)
          Gets the index of an attribute by qualified name.
 int getIndex(java.lang.String uri, java.lang.String localName)
          Gets the index of an attribute by namespace name.
 int getLength()
          Gets the number of attributes in the list.
 java.lang.String getLocalName(int index)
          Gets the local name by index.
 java.lang.String getQName(int index)
          Gets the qualified name by index.
 java.lang.String getType(int index)
          Gets the attribute SAX type by namespace name.
 java.lang.String getType(java.lang.String qName)
          Gets the attribute SAX type by qualified name.
 java.lang.String getType(java.lang.String uri, java.lang.String localName)
          Gets the attribute SAX type by namespace name.
 java.lang.String getURI(int index)
          Gets the namespace URI for attribute at the given index.
 java.lang.String getValue(int index)
          Gets the value for the attribute at given index.
 java.lang.String getValue(java.lang.String qName)
          Gets the value for the attribute by qualified name.
 java.lang.String getValue(java.lang.String uri, java.lang.String localName)
          Gets the value for the attribute by namespace name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idValue

private java.lang.String idValue
ID attribute value


idAttributeName

private java.lang.String idAttributeName
ID attribute name


matchingAttribute

private boolean matchingAttribute

length

private int length

idIndex

private int idIndex
Constructor Detail

AbstractBeanWriter.IDElementAttributes

AbstractBeanWriter.IDElementAttributes(ElementDescriptor descriptor,
                                       Context context,
                                       java.lang.String idAttributeName,
                                       java.lang.String idValue)
Construct attributes for element and context.

Parameters:
descriptor - the ElementDescriptor describing the element
context - evaluate against this context
idAttributeName - the name of the id attribute
idValue - the ID attribute value
Method Detail

getIndex

public int getIndex(java.lang.String uri,
                    java.lang.String localName)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the index of an attribute by namespace name.

Specified by:
getIndex in interface org.xml.sax.Attributes
Overrides:
getIndex in class AbstractBeanWriter.ElementAttributes
Parameters:
uri - the namespace uri of the attribute
localName - the local name of the attribute
Returns:
the index of the attribute - or -1 if there is no matching attribute

getIndex

public int getIndex(java.lang.String qName)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the index of an attribute by qualified name.

Specified by:
getIndex in interface org.xml.sax.Attributes
Overrides:
getIndex in class AbstractBeanWriter.ElementAttributes
Parameters:
qName - the qualified name of the attribute
Returns:
the index of the attribute - or -1 if there is no matching attribute

getLength

public int getLength()
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the number of attributes in the list.

Specified by:
getLength in interface org.xml.sax.Attributes
Overrides:
getLength in class AbstractBeanWriter.ElementAttributes
Returns:
the number of attributes in this list

getLocalName

public java.lang.String getLocalName(int index)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the local name by index.

Specified by:
getLocalName in interface org.xml.sax.Attributes
Overrides:
getLocalName in class AbstractBeanWriter.ElementAttributes
Parameters:
index - the attribute index (zero based)
Returns:
the attribute local name - or null if the index is out of range

getQName

public java.lang.String getQName(int index)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the qualified name by index.

Specified by:
getQName in interface org.xml.sax.Attributes
Overrides:
getQName in class AbstractBeanWriter.ElementAttributes
Parameters:
index - the attribute index (zero based)
Returns:
the qualified name of the element - or null if the index is our of range

getType

public java.lang.String getType(int index)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the attribute SAX type by namespace name.

Specified by:
getType in interface org.xml.sax.Attributes
Overrides:
getType in class AbstractBeanWriter.ElementAttributes
Parameters:
index - the attribute index (zero based)
Returns:
the attribute type (as a string) or null if the index is out of range

getType

public java.lang.String getType(java.lang.String uri,
                                java.lang.String localName)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the attribute SAX type by namespace name.

Specified by:
getType in interface org.xml.sax.Attributes
Overrides:
getType in class AbstractBeanWriter.ElementAttributes
Parameters:
uri - the namespace uri of the attribute
localName - the local name of the attribute
Returns:
the attribute type (as a string) or null if the attribute is not in the list

getType

public java.lang.String getType(java.lang.String qName)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the attribute SAX type by qualified name.

Specified by:
getType in interface org.xml.sax.Attributes
Overrides:
getType in class AbstractBeanWriter.ElementAttributes
Parameters:
qName - the qualified name of the attribute
Returns:
the attribute type (as a string) or null if the attribute is not in the list

getURI

public java.lang.String getURI(int index)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the namespace URI for attribute at the given index.

Specified by:
getURI in interface org.xml.sax.Attributes
Overrides:
getURI in class AbstractBeanWriter.ElementAttributes
Parameters:
index - the attribute index (zero-based)
Returns:
the namespace URI (empty string if none is available) or null if the index is out of range

getValue

public java.lang.String getValue(int index)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the value for the attribute at given index.

Specified by:
getValue in interface org.xml.sax.Attributes
Overrides:
getValue in class AbstractBeanWriter.ElementAttributes
Parameters:
index - the attribute index (zero based)
Returns:
the attribute value or null if the index is out of range

getValue

public java.lang.String getValue(java.lang.String uri,
                                 java.lang.String localName)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the value for the attribute by namespace name.

Specified by:
getValue in interface org.xml.sax.Attributes
Overrides:
getValue in class AbstractBeanWriter.ElementAttributes
Parameters:
uri - the namespace URI of the attribute
localName - the local name of the attribute
Returns:
the attribute value or null if there are not attributes with the given namespace and local name

getValue

public java.lang.String getValue(java.lang.String qName)
Description copied from class: AbstractBeanWriter.ElementAttributes
Gets the value for the attribute by qualified name.

Specified by:
getValue in interface org.xml.sax.Attributes
Overrides:
getValue in class AbstractBeanWriter.ElementAttributes
Parameters:
qName - the qualified name
Returns:
the attribute value or null if there are no attributes with the given qualified name