Class AbstractJid
- All Implemented Interfaces:
Serializable
,CharSequence
,Comparable<Jid>
,Jid
- Direct Known Subclasses:
DomainAndResourcepartJid
,DomainpartJid
,LocalAndDomainpartJid
,LocalDomainAndResourcepartJid
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConvert this Jid to aDomainFullJid
or throw anIllegalStateException
if this is not possible.final EntityBareJid
Convert this Jid to aEntityBareJid
or throw anIllegalStateException
if this is not possible.Convert this Jid to aEntityFullJid
or throw anIllegalStateException
if this is not possible.Convert this Jid to aEntityJid
or throw anIllegalStateException
if this is not possible.Convert this Jid to aFullJid
or throw anIllegalStateException
if this is not possible.final String
Get the URL encoded version of this JID.char
charAt
(int index) final int
final <T extends Jid>
TReturn the downcasted instance of this Jid.final boolean
equals
(CharSequence charSequence) Compares the given CharSequence with this JID.final boolean
final boolean
Compares the given String wit this JID.abstract Localpart
Get the localpart of this JID or null.final Localpart
Get the localpart of this JID or throw anIllegalStateException
.final Resourcepart
Get the resourcepart of this JID or return the empty resourcepart.abstract Resourcepart
Get the resourcepart of this JID or null.final Resourcepart
Get the resourcepart of this JID or throw anIllegalStateException
.final int
hashCode()
final boolean
Check if this is a Jid with aLocalpart
.abstract boolean
Check if this is an instance ofEntityBareJid
orDomainBareJid
.final boolean
Check if this is a Jid with aResourcepart
.final String
intern()
Returns the canonical String representation of this JID.final boolean
Check if this is an instance ofDomainBareJid
.final boolean
Check if this is an instance ofDomainFullJid
.final boolean
Check if this is an instance ofEntityBareJid
.final boolean
Check if this is an instance ofEntityFullJid
.final boolean
Check if this is aEntityBareJid
orEntityFullJid
.final boolean
isParentOf
(Jid jid) Check if this JID is the parent of another JID.final boolean
isStrictParentOf
(Jid jid) Check if this JID is the strict parent of another JID.int
length()
subSequence
(int start, int end) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.CharSequence
chars, codePoints
Methods inherited from interface org.jxmpp.jid.Jid
asBareJid, asDomainBareJid, asDomainFullJidIfPossible, asEntityBareJidIfPossible, asEntityFullJidIfPossible, asEntityJidIfPossible, asFullJidIfPossible, asUnescapedString, getDomain, isParentOf, isParentOf, isParentOf, isParentOf, isStrictParentOf, isStrictParentOf, isStrictParentOf, isStrictParentOf, toString
-
Field Details
-
cache
Cache for the String representation of this JID.
-
-
Constructor Details
-
AbstractJid
public AbstractJid()
-
-
Method Details
-
isEntityJid
Description copied from interface:Jid
Check if this is aEntityBareJid
orEntityFullJid
.- Specified by:
isEntityJid
in interfaceJid
- Returns:
- true if this is an instance of BareJid or FullJid.
-
isEntityBareJid
Description copied from interface:Jid
Check if this is an instance ofEntityBareJid
.- Specified by:
isEntityBareJid
in interfaceJid
- Returns:
- true if this is an instance of EntityBareJid
-
isEntityFullJid
Description copied from interface:Jid
Check if this is an instance ofEntityFullJid
.- Specified by:
isEntityFullJid
in interfaceJid
- Returns:
- true if this is an instance of EntityFullJid
-
isDomainBareJid
Description copied from interface:Jid
Check if this is an instance ofDomainBareJid
.- Specified by:
isDomainBareJid
in interfaceJid
- Returns:
- true if this is an instance of DomainBareJid
-
isDomainFullJid
Description copied from interface:Jid
Check if this is an instance ofDomainFullJid
.- Specified by:
isDomainFullJid
in interfaceJid
- Returns:
- true if this is an instance of DomainFullJid
-
hasNoResource
Description copied from interface:Jid
Check if this is an instance ofEntityBareJid
orDomainBareJid
.- Specified by:
hasNoResource
in interfaceJid
- Returns:
- true if this is an instance of BareJid or DomainBareJid
-
hasResource
Description copied from interface:Jid
Check if this is a Jid with aResourcepart
.- Specified by:
hasResource
in interfaceJid
- Returns:
- true if this Jid has a resourcepart.
-
hasLocalpart
Description copied from interface:Jid
Check if this is a Jid with aLocalpart
.- Specified by:
hasLocalpart
in interfaceJid
- Returns:
- true if this Jid has a localpart.
-
downcast
Description copied from interface:Jid
Return the downcasted instance of this Jid. This method is unsafe, make sure to check that this is actually of the type of are casting to. -
length
- Specified by:
length
in interfaceCharSequence
-
charAt
- Specified by:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
asEntityBareJidOrThrow
Description copied from interface:Jid
Convert this Jid to aEntityBareJid
or throw anIllegalStateException
if this is not possible.- Specified by:
asEntityBareJidOrThrow
in interfaceJid
- Returns:
- the corresponding
EntityBareJid
.
-
asEntityFullJidOrThrow
Description copied from interface:Jid
Convert this Jid to aEntityFullJid
or throw anIllegalStateException
if this is not possible.- Specified by:
asEntityFullJidOrThrow
in interfaceJid
- Returns:
- the corresponding
EntityFullJid
.
-
asEntityJidOrThrow
Description copied from interface:Jid
Convert this Jid to aEntityJid
or throw anIllegalStateException
if this is not possible.- Specified by:
asEntityJidOrThrow
in interfaceJid
- Returns:
- the corresponding
EntityJid
.
-
asFullJidOrThrow
Description copied from interface:Jid
Convert this Jid to aFullJid
or throw anIllegalStateException
if this is not possible.- Specified by:
asFullJidOrThrow
in interfaceJid
- Returns:
- the corresponding
FullJid
.
-
asDomainFullJidOrThrow
Description copied from interface:Jid
Convert this Jid to aDomainFullJid
or throw anIllegalStateException
if this is not possible.- Specified by:
asDomainFullJidOrThrow
in interfaceJid
- Returns:
- the corresponding
DomainFullJid
.
-
getResourceOrNull
Description copied from interface:Jid
Get the resourcepart of this JID or null.If the JID is of form
<localpart@domain.example/resource>
then this method returns 'resource'. If the JID no resourcepart, thennull
is returned.- Specified by:
getResourceOrNull
in interfaceJid
- Returns:
- the resource of this JID or null.
-
getResourceOrEmpty
Description copied from interface:Jid
Get the resourcepart of this JID or return the empty resourcepart.If the JID is of form
<localpart@domain.example/resource>
then this method returns 'resource'. If the JID no resourcepart, thenResourcepart.EMPTY
is returned.- Specified by:
getResourceOrEmpty
in interfaceJid
- Returns:
- the resource of this JID or the empty resourcepart.
-
getResourceOrThrow
Description copied from interface:Jid
Get the resourcepart of this JID or throw anIllegalStateException
.If the JID is of form
<localpart@domain.example/resource>
then this method returns 'resource'. If the JID no resourcepart, then anIllegalStateException
is thrown.- Specified by:
getResourceOrThrow
in interfaceJid
- Returns:
- the resource of this JID.
-
getLocalpartOrNull
Description copied from interface:Jid
Get the localpart of this JID or null.If the JID is of form
<localpart@domain.example>
then this method returns 'localpart'. If the JID has no localpart, thennull
is returned.- Specified by:
getLocalpartOrNull
in interfaceJid
- Returns:
- the localpart of this JID or null.
-
getLocalpartOrThrow
Description copied from interface:Jid
Get the localpart of this JID or throw anIllegalStateException
.If the JID is of form
<localpart@domain.example>
then this method returns 'localpart'. If the JID has no localpart, thennull
is returned.- Specified by:
getLocalpartOrThrow
in interfaceJid
- Returns:
- the localpart of this JID.
-
isParentOf
Description copied from interface:Jid
Check if this JID is the parent of another JID. The parent of relation is defined, under the precondition that the JID parts (localpart, domainpart and resourcepart) are equal, as follows:| 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 |
- Specified by:
isParentOf
in interfaceJid
- Parameters:
jid
- the other JID to compare with- Returns:
- true if this JID is a parent of the given JID.
-
isStrictParentOf
Description copied from interface:Jid
Check if this JID is the strict parent of another JID. In other words, all parts of this JID must exist on the other JID, and match this JID's values. Furthermore, and this is what makes this method different fromJid.isParentOf(Jid)
, the other JID must have one additional part, that this JID does not have. The parent of relation is defined, under the precondition that the JID parts (localpart, domainpart and resourcepart) are equal, as follows:| this JID | other JID | result | |---------------------+---------------------+--------| | dom.example | dom.example | false | (different from isParentOf) | 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 | false | (different from isParentOf) | 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 | false | (different from isParentOf) | 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 | false | (different from isParentOf)
- Specified by:
isStrictParentOf
in interfaceJid
- Parameters:
jid
- the other JID to compare with- Returns:
- true if this JID is a parent of the given JID.
-
hashCode
-
equals
-
equals
Description copied from interface:Jid
Compares the given CharSequence with this JID. Returns true ifequals(charSequence.toString()
would return true. -
equals
Description copied from interface:Jid
Compares the given String wit this JID.Returns true if
toString().equals(string)
, that is if the String representation of this JID matches the given string. -
compareTo
- Specified by:
compareTo
in interfaceComparable<Jid>
-
intern
Description copied from interface:Jid
Returns the canonical String representation of this JID. SeeString.intern()
for details. -
asUrlEncodedString
Description copied from interface:Jid
Get the URL encoded version of this JID.- Specified by:
asUrlEncodedString
in interfaceJid
- Returns:
- the URL encoded version of this JID.
-