org.ws4d.java.types
Class QNameAttributeValue

java.lang.Object
  extended by org.ws4d.java.types.QNameAttributeValue
All Implemented Interfaces:
CustomAttributeValue

public class QNameAttributeValue
extends java.lang.Object
implements CustomAttributeValue

Representation of an attribute value as a qualified name.


Constructor Summary
QNameAttributeValue()
           
QNameAttributeValue(QName value)
          Creates a new instance with the specified value.
 
Method Summary
 HashMap getNamespaces()
          Returns the namespaces used within this attribute value.
 java.lang.Object getValue()
          Returns the value of the attribute.
 void serialize(org.xmlpull.v1.XmlSerializer serializer, QName attributeName)
          Serializes this attribute value using the provided XmlSerializer.
 void setValue(QName value)
          Sets the value for this attribute.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QNameAttributeValue

public QNameAttributeValue()

QNameAttributeValue

public QNameAttributeValue(QName value)
Creates a new instance with the specified value.

Parameters:
value - the attribute's value
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getNamespaces

public HashMap getNamespaces()
Description copied from interface: CustomAttributeValue
Returns the namespaces used within this attribute value. These namespaces should be declared appropriately on an enclosing element. Each namespace is stored as String key within the hash map. The corresponding value is a recommended prefix (as String) for this namespace. It will be declared for use with that namespace, if it is available within the scope of this attribute (i.e. not associated with a different namespace).

Specified by:
getNamespaces in interface CustomAttributeValue
Returns:
the namespaces used within this attribute

getValue

public java.lang.Object getValue()
Description copied from interface: CustomAttributeValue
Returns the value of the attribute.

Specified by:
getValue in interface CustomAttributeValue
Returns:
this attribute's value

setValue

public void setValue(QName value)
Sets the value for this attribute. If the attribute had a previous value, its namespace will be removed from the namespaces to be declared for this attribute instance. Consequently, if the new value is not null, its namespace will be added to the namespaces to declare in the surrounding scope of this attribute.

Parameters:
value - the new value for the attribute

serialize

public void serialize(org.xmlpull.v1.XmlSerializer serializer,
                      QName attributeName)
               throws java.io.IOException
Description copied from interface: CustomAttributeValue
Serializes this attribute value using the provided XmlSerializer. The value is assigned to an attribute with the specified qualified name attributeName.

Specified by:
serialize in interface CustomAttributeValue
Parameters:
serializer - the serializer to write the attribute value to
attributeName - the name of the attribute to assign this attribute value to
Throws:
java.io.IOException - if an error occurs during writing to the serializer