|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.realtime.xmpp.types.JID
Manage a Jabber identifier. The identifier takes the form [node@]domain[/resource] where both node and resource are optional.
This class provides fast parsing and minimal object creation through late binding of the identifier elements to strings.
Note that this class supports zero-length nodes and resources. If a JID is created as user@home/ then the node will be 'user' and the resource will be a zero length string. Whereas a JID of home/play will have a null user, and a resource of 'play'. The simple rule is that when a delimiter (either @ or /) is specified, then a string will be available.
Field Summary | |
protected boolean |
m_bHashed
|
protected int |
m_nHash
|
protected int |
m_pAt
|
protected int |
m_pSlash
|
protected java.lang.String |
m_sDomain
|
protected java.lang.String |
m_sJid
|
protected java.lang.String |
m_sNode
|
protected java.lang.String |
m_sResource
|
Constructor Summary | |
JID(java.lang.String sJid)
Create a JID from a simple string. |
|
JID(java.lang.String sNode,
java.lang.String sDomain,
java.lang.String sResource)
Create the JID from a node, domain and resource. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Compare two JIDs for equality. |
java.lang.String |
getDomain()
Provide the domain. |
java.lang.String |
getNode()
Provide the node, or null if there is none. |
java.lang.String |
getResource()
Provide the resource, or null if there was none. |
int |
hashCode()
Generate a hashcode. |
static void |
main(java.lang.String[] argv)
|
JID |
pruneResource()
Provide a JID equivalent to this JID, but without the resource. |
JID |
setResource(java.lang.String sResource)
Add a resource to a JID. |
protected static void |
test(java.lang.String sJid,
java.lang.String sNegativeTest)
|
java.lang.String |
toString()
Provide the original string used to create the jid. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int m_pAt
protected int m_pSlash
protected java.lang.String m_sJid
protected java.lang.String m_sNode
protected java.lang.String m_sDomain
protected java.lang.String m_sResource
protected boolean m_bHashed
protected int m_nHash
Constructor Detail |
public JID(java.lang.String sNode, java.lang.String sDomain, java.lang.String sResource)
Create the JID from a node, domain and resource.
sNode
- The node, or null.
* @param sDomain The domain, the MUST NOT be null.
* @param sResource The resource, or null.public JID(java.lang.String sJid)
Create a JID from a simple string.
The string takes the form [node@]host[/resource] where both node and resource are optional.
* @param sJid The JID to parse.
Method Detail |
public java.lang.String getNode()
Provide the node, or null if there is none.
* @return The node, or null if there was none.
public java.lang.String getDomain()
Provide the domain.
* @return The domain.
public java.lang.String getResource()
Provide the resource, or null if there was none.
public JID pruneResource()
Provide a JID equivalent to this JID, but without the resource. If this JID does not have a resource, then a handle to the existing JID is returned.
* @return If this JID has a resource, a new JID with just the node and domain is created. Otherwise, a handle to the existing JID is returned.
public JID setResource(java.lang.String sResource)
Add a resource to a JID. IF the resource is the same as the existing one, the current JID is returned. If the resource is different, a new JID will be created with the new resource.
* @param sResource * @return A JID with the new resource.
public java.lang.String toString()
Provide the original string used to create the jid.
* @return A simple Jabber compliant string of the form [node@]domain[/resource], where both node and resource are optional.
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Compare two JIDs for equality. Honors the Jabber spec by doing case insensitive compares of the domain and node portion of the Jabber id.
* @param obj The JID to compare with. May either be a JID or a String.
equals
in class java.lang.Object
public int hashCode()
Generate a hashcode.
* @see java.lang.Object#hashCode()
hashCode
in class java.lang.Object
protected static void test(java.lang.String sJid, java.lang.String sNegativeTest)
public static void main(java.lang.String[] argv)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |