Package jadex.xml.stax
Class QName
- java.lang.Object
-
- jadex.xml.stax.QName
-
- All Implemented Interfaces:
java.io.Serializable
public class QName extends java.lang.Object implements java.io.Serializable
StaX API: QName- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description QName(java.lang.String localPart)
Constructor for the QName with just a local part.QName(java.lang.String namespaceURI, java.lang.String localPart)
Constructor for the QName with a namespace URI and a local part.QName(java.lang.String namespaceURI, java.lang.String localPart, java.lang.String prefix)
Constructor for the QName.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Tests this QName for equality with another object.java.lang.String
getLocalPart()
Gets the Local part for this QName.java.lang.String
getNamespaceURI()
Gets the Namespace URI for this QName.java.lang.String
getPrefix()
Gets the prefix for this QName.int
hashCode()
Returns a hash code value for this QName object.java.lang.String
toString()
Returns a string representation of this QName.static QName
valueOf(java.lang.String s)
Returns a QName holding the value of the specified String.
-
-
-
Constructor Detail
-
QName
public QName(java.lang.String localPart)
Constructor for the QName with just a local part. This assigns an empty string as the default values fornamespaceURI
,prefix
andlocalPart
.- Parameters:
localPart
- Local part of the QName- Throws:
java.lang.IllegalArgumentException
- If null local part is specified
-
QName
public QName(java.lang.String namespaceURI, java.lang.String localPart)
Constructor for the QName with a namespace URI and a local part. This method assigns an empty string as the default value forprefix
.- Parameters:
namespaceURI
- Namespace URI for the QNamelocalPart
- Local part of the QName- Throws:
java.lang.IllegalArgumentException
- If null local part or namespaceURI is specified
-
QName
public QName(java.lang.String namespaceURI, java.lang.String localPart, java.lang.String prefix)
Constructor for the QName.- Parameters:
namespaceURI
- Namespace URI for the QNamelocalPart
- Local part of the QNameprefix
- The prefix of the QName- Throws:
java.lang.IllegalArgumentException
- If null local part or prefix is specified
-
-
Method Detail
-
getNamespaceURI
public java.lang.String getNamespaceURI()
Gets the Namespace URI for this QName.- Returns:
- Namespace URI
-
getLocalPart
public java.lang.String getLocalPart()
Gets the Local part for this QName.- Returns:
- Local part
-
getPrefix
public java.lang.String getPrefix()
Gets the prefix for this QName. Note that the prefix assigned to a QName may not be valid in a different context. For example, a QName may be assigned a prefix in the context of parsing a document but that prefix may be invalid in the context of a different document.- Returns:
- a
String
value of the prefix.
-
toString
public java.lang.String toString()
Returns a string representation of this QName.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of the QName
-
valueOf
public static QName valueOf(java.lang.String s)
Returns a QName holding the value of the specified String. The string must be in the form returned by the QName.toString() method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}" part being optional. This method doesn't do a full validation of the resulting QName. In particular, it doesn't check that the resulting namespace URI is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting local part is a legal NCName per the XML Namespaces specification.- Parameters:
s
- the string to be parsed- Returns:
- QName corresponding to the given String
- Throws:
java.lang.IllegalArgumentException
- If the specified String cannot be parsed as a QName
-
hashCode
public final int hashCode()
Returns a hash code value for this QName object. The hash code is based on both the localPart and namespaceURI parts of the QName. This method satisfies the general contract of theObject.hashCode
method.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code value for this Qname object
-
equals
public final boolean equals(java.lang.Object obj)
Tests this QName for equality with another object.String.equals to check equality of localPart and namespaceURI.
Object.equals method.
- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the reference object with which to compare.- Returns:
-
-