org.jbind.xml.base
Class QName

java.lang.Object
  extended byorg.jbind.xml.base.QName
All Implemented Interfaces:
IQName, java.io.Serializable
Direct Known Subclasses:
QualifiedName

public class QName
extends java.lang.Object
implements IQName

Represents a qualified name.

See Also:
Serialized Form

Field Summary
protected  java.lang.String myNamespace
           
 
Constructor Summary
protected QName(java.lang.String aPrefix, java.lang.String aLocalName, java.lang.String aNamespace)
           
 
Method Summary
static QName create(java.lang.String aQName, java.util.Map aPrefixToNamespaceMapping)
          Creates a QName.
 boolean equals(java.lang.Object anObject)
          Checks equalitiy.
 java.lang.String getLocalPart()
          Gets the local part.
static java.lang.String getLocalPart(java.lang.String aQName)
          Gets the local part of a QName.
 java.lang.String getNamespace()
          Gets the namespace.
 java.lang.String getPrefix()
          Gets the prefix.
 int hashCode()
          Returns the sum of the hash codes of the namespace and the local part.
 java.lang.String toString()
          Gets the string representation of the QName.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myNamespace

protected java.lang.String myNamespace
Constructor Detail

QName

protected QName(java.lang.String aPrefix,
                java.lang.String aLocalName,
                java.lang.String aNamespace)
Method Detail

getLocalPart

public static final java.lang.String getLocalPart(java.lang.String aQName)
Gets the local part of a QName.

Parameters:
aQName - (required).
Returns:
(required).

create

public static final QName create(java.lang.String aQName,
                                 java.util.Map aPrefixToNamespaceMapping)
Creates a QName.

Parameters:
aQName - (optional).
aPrefixToNamespaceMapping - (required).
Returns:
(optional). If the provided QName does not satisfied the syntactic constraints of QNames or the namespace could not be determined then null is returned.

getPrefix

public java.lang.String getPrefix()
Description copied from interface: IQName
Gets the prefix.

Attention: If the prefix is null then this does not mean that the QName has no prefix. It means only that a prefix for the QName has not yet been determined. The empty string is used to indicate that the QName has prefix.

Specified by:
getPrefix in interface IQName
Returns:
(optional).

getLocalPart

public java.lang.String getLocalPart()
Description copied from interface: IQName
Gets the local part.

Specified by:
getLocalPart in interface IQName
Returns:
(required).

getNamespace

public java.lang.String getNamespace()
Description copied from interface: IQName
Gets the namespace. QNames of elements in the default namespace and QNames of local attributes return the empty string.

Specified by:
getNamespace in interface IQName
Returns:
(required).

toString

public java.lang.String toString()
Description copied from interface: IQName
Gets the string representation of the QName. If the prefix of the QName is not null and not equal to the empty string then the concatentation of the prefix, a colon, and the local part is returned. If the prefix is null then the concatentation of "?:" and the local part is returned. If the prefix is equal to the empty string then the local part is returned.

Specified by:
toString in interface IQName

equals

public final boolean equals(java.lang.Object anObject)
Description copied from interface: IQName
Checks equalitiy.

Specified by:
equals in interface IQName

hashCode

public final int hashCode()
Description copied from interface: IQName
Returns the sum of the hash codes of the namespace and the local part. The prefix is not considered.

Specified by:
hashCode in interface IQName