Class QName

java.lang.Object
org.jibx.runtime.QName

public class QName extends Object

Representation of a qualified name. This includes the JiBX serializer/deserializer methods for the representation. It assumes that the actual namespace declarations are being handled separately for marshalling

Note that this implementation treats only the namespace and local name as significant for purposes of comparing values. The prefix is held only as a convenience, and the actual prefix used when writing a value may differ from the prefix defined by the instance.

Author:
Dennis M. Sosnoski
  • Field Details

    • m_uri

      private String m_uri
      Namespace URI.
    • m_prefix

      private String m_prefix
      Namespace prefix.
    • m_name

      private String m_name
      Local name.
  • Constructor Details

    • QName

      public QName(String uri, String prefix, String name)
      Constructor from full set of components.
      Parameters:
      uri - namespace uri, null if no-namespace namespace
      prefix - namespace prefix, null if unspecified, empty string if default namespace
      name - local name
    • QName

      public QName(String uri, String name)
      Constructor from namespace and local name. This constructor is provided as a convenience for when the actual prefix used for a namespace is irrelevant.
      Parameters:
      uri - namespace uri, null if no-namespace namespace
      name -
    • QName

      public QName(String name)
      Constructor from local name only. This constructor is provided as a convenience for names in the no-namespace namespace.
      Parameters:
      name -
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getName

      public String getName()
      Get local name.
      Returns:
      name
    • setName

      public void setName(String name)
      Set local name.
      Parameters:
      name - name
    • getPrefix

      public String getPrefix()
      Get namespace prefix.
      Returns:
      prefix, null if unspecified, empty string if default namespace
    • setPrefix

      public void setPrefix(String prefix)
      Set namespace prefix.
      Parameters:
      prefix - prefix, null if unspecified, empty string if default namespace
    • getUri

      public String getUri()
      Get namespace URI.
      Returns:
      uri namespace uri, null if no-namespace namespace
    • setUri

      public void setUri(String uri)
      Set namespace URI.
      Parameters:
      uri - namespace uri, null if no-namespace namespace
    • deserialize

      public static QName deserialize(String text, IUnmarshallingContext ictx) throws JiBXException
      JiBX deserializer method. This is intended for use as a deserializer for instances of the class.
      Parameters:
      text - value text
      ictx - unmarshalling context
      Returns:
      created class instance
      Throws:
      JiBXException - on error in unmarshalling
    • serialize

      public static String serialize(QName qname, IMarshallingContext ictx) throws JiBXException
      JiBX serializer method. This is intended for use as a serializer for instances of the class. The namespace must be active in the output document at the point where this is called.
      Parameters:
      qname - value to be serialized
      ictx - unmarshalling context
      Returns:
      created class instance
      Throws:
      JiBXException - on error in marshalling
    • deserializeList

      public static QName[] deserializeList(String text, IUnmarshallingContext ictx) throws JiBXException
      JiBX deserializer method. This is intended for use as a deserializer for a list made up of instances of the class.
      Parameters:
      text - value text
      ictx - unmarshalling context
      Returns:
      array of instances
      Throws:
      JiBXException - on error in marshalling
    • serializeList

      public static String serializeList(QName[] qnames, IMarshallingContext ictx) throws JiBXException
      JiBX serializer method. This is intended for use as a serializer for a list made up of instances of the class. The namespace must be active in the output document at the point where this is called.
      Parameters:
      qnames - array of names to be serialized
      ictx - unmarshalling context
      Returns:
      generated text
      Throws:
      JiBXException - on error in marshalling