public interface Jid extends java.lang.Comparable<Jid>, java.lang.CharSequence, java.io.Serializable
JidCreate utility.
Jid jid = JidCreate.from("juliet@capulet.org/balcony");
BareJid bareJid = JidCreate.from("romeo@montague.net");
This is the super interface for all JID types. Every JID consists at least of
a Domainpart. You can retrieve the escaped String representing the Jid with toString()
or the unsecaped String of the JID with asUnescapedString().| Modifier and Type | Method and Description |
|---|---|
BareJid |
asBareJidIfPossible()
Convert this Jid to a BareJid if possible.
|
DomainBareJid |
asDomainBareJid()
Convert this Jid to a
DomainBareJid. |
DomainFullJid |
asDomainFullJidIfPossible()
Convert this Jid to a
DomainFullJid if possible. |
FullJid |
asFullJidIfPossible()
Convert this Jid to a FullJid if possible.
|
JidWithLocalpart |
asJidWithLocalpartIfPossible()
Convert this Jid to a
JidWithLocalpart if possible. |
JidWithResource |
asJidWithResourcepartIfPossible()
Convert this Jid to a
JidWithResource if possible. |
java.lang.String |
asUnescapedString()
Return the unescaped String representation of this JID.
|
<T extends Jid> |
downcast()
Return the downcasted instance of this Jid.
|
boolean |
equals(java.lang.CharSequence charSequence)
Compares the given CharSequence with this JID.
|
boolean |
equals(java.lang.String string)
Compares the given String wit this JID.
|
Domainpart |
getDomain()
Get the
Domainpart of this Jid. |
Localpart |
getLocalpartOrNull()
Get the localpart of this JID or null.
|
Resourcepart |
getResourceOrNull()
Get the resourcepart of this JID or null.
|
boolean |
hasLocalpart()
Check if this is a Jid with a
Localpart. |
boolean |
hasNoResource()
Check if this is an instance of
BareJid or DomainBareJid. |
boolean |
hasResource()
Check if this is a Jid with a
Resourcepart. |
boolean |
isBareJid()
Check if this is an instance of
BareJid. |
boolean |
isBareOrFullJid()
|
boolean |
isDomainBareJid()
Check if this is an instance of
DomainBareJid. |
boolean |
isDomainFullJid()
Check if this is an instance of
DomainFullJid. |
boolean |
isFullJid()
Check if this is an instance of
FullJid. |
boolean |
isParentOf(BareJid bareJid)
See
isParentOf(Jid). |
boolean |
isParentOf(DomainBareJid domainBareJid)
See
isParentOf(Jid). |
boolean |
isParentOf(DomainFullJid domainFullJid)
See
isParentOf(Jid). |
boolean |
isParentOf(FullJid fullJid)
See
isParentOf(Jid). |
boolean |
isParentOf(Jid jid)
Check if this JID is the parent of another JID.
|
java.lang.String |
toString()
Returns the String representation of this JID.
|
Jid |
withoutResource()
Return a JID created by removing the Resourcepart from this JID.
|
Domainpart getDomain()
Domainpart of this Jid.java.lang.String toString()
toString in interface java.lang.CharSequencetoString in class java.lang.Objectjava.lang.String asUnescapedString()
Since certain Unicode code points are disallowed in the localpart of a JID by the required stringprep profile, those need to get escaped when used in a real JID. The unescaped representation of the JID is only for presentation to a human user or for gatewaying to a non-XMPP system.
For example, if the users inputs'at&t guy@example.com', the escaped real JID created with
JidCreate will be 'at\26t\20guy@example.com', which is what
toString() will return. But asUnescapedString() will return again
'at&t guy@example.com'.boolean isBareOrFullJid()
boolean isBareJid()
BareJid.boolean isFullJid()
FullJid.boolean isDomainBareJid()
DomainBareJid.boolean isDomainFullJid()
DomainFullJid.boolean hasNoResource()
BareJid or DomainBareJid.boolean hasResource()
Resourcepart.boolean hasLocalpart()
Localpart.BareJid asBareJidIfPossible()
FullJid asFullJidIfPossible()
JidWithLocalpart asJidWithLocalpartIfPossible()
JidWithLocalpart if possible.JidWithResource asJidWithResourcepartIfPossible()
JidWithResource if possible.DomainBareJid asDomainBareJid()
DomainBareJid.
Note that it is always possible to convert a Jid to a DomainBareJid, since every Jid has a domain part.
DomainFullJid asDomainFullJidIfPossible()
DomainFullJid if possible.Resourcepart getResourceOrNull()
If the JID is of form <localpart@domain.example/resource> then this method returns 'resource'. If the JID no
resourcepart, then null is returned.
Localpart getLocalpartOrNull()
If the JID is of form <localpart@domain.example> then this method returns 'localpart'. If the JID has no
localpart, then null is returned.
Jid withoutResource()
boolean isParentOf(Jid jid)
| this JID (parentOf) | other JID | result | |---------------------+---------------------+--------| | dom.example | dom.example | true | | dom.example | dom.example/res | true | | dom.example | loc@dom.example | true | | dom.example | loc@dom.example/res | true | | dom.example/res | dom.exmple | false | | dom.example/res | dom.example/res | true | | dom.example/res | loc@dom.example | false | | dom.example/res | loc@dom.example/res | false | | loc@dom.example | dom.example | false | | loc@dom.example | dom.example/res | false | | loc@dom.example | loc@dom.example | true | | loc@dom.example | loc@dom.example/res | true | | loc@dom.example/res | dom.example | false | | loc@dom.example/res | dom.example/res | false | | loc@dom.example/res | loc@dom.example | false | | loc@dom.example/res | loc@dom.example/res | true |
jid - the other JID to compare withboolean isParentOf(BareJid bareJid)
isParentOf(Jid).bareJid - the bare JID.boolean isParentOf(FullJid fullJid)
isParentOf(Jid).fullJid - the full JID.boolean isParentOf(DomainBareJid domainBareJid)
isParentOf(Jid).domainBareJid - the domain bare JID.boolean isParentOf(DomainFullJid domainFullJid)
isParentOf(Jid).domainFullJid - the domain full JID.<T extends Jid> T downcast()
T - the Jid type to downcast to.boolean equals(java.lang.CharSequence charSequence)
equals(charSequence.toString() would
return true.charSequence - the CharSequence to compare this JID with.equals(charSequence.toString() would return true.equals(String)boolean equals(java.lang.String string)
Returns true if toString().equals(string), that is if the String representation of this JID matches the given string.
string - the String to compare this JID with.toString().equals(string).