Class AbstractJid
- All Implemented Interfaces:
Serializable,CharSequence,Comparable<Jid>,Jid
- Direct Known Subclasses:
DomainAndResourcepartJid,DomainpartJid,LocalAndDomainpartJid,LocalDomainAndResourcepartJid
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvert this Jid to aDomainFullJidor throw anIllegalStateExceptionif this is not possible.final EntityBareJidConvert this Jid to aEntityBareJidor throw anIllegalStateExceptionif this is not possible.Convert this Jid to aEntityFullJidor throw anIllegalStateExceptionif this is not possible.Convert this Jid to aEntityJidor throw anIllegalStateExceptionif this is not possible.Convert this Jid to aFullJidor throw anIllegalStateExceptionif this is not possible.final StringGet the URL encoded version of this JID.charcharAt(int index) final intfinal <T extends Jid>
TReturn the downcasted instance of this Jid.final booleanequals(CharSequence charSequence) Compares the given CharSequence with this JID.final booleanfinal booleanCompares the given String wit this JID.abstract LocalpartGet the localpart of this JID or null.final LocalpartGet the localpart of this JID or throw anIllegalStateException.final ResourcepartGet the resourcepart of this JID or return the empty resourcepart.abstract ResourcepartGet the resourcepart of this JID or null.final ResourcepartGet the resourcepart of this JID or throw anIllegalStateException.final inthashCode()final booleanCheck if this is a Jid with aLocalpart.abstract booleanCheck if this is an instance ofEntityBareJidorDomainBareJid.final booleanCheck if this is a Jid with aResourcepart.final Stringintern()Returns the canonical String representation of this JID.final booleanCheck if this is an instance ofDomainBareJid.final booleanCheck if this is an instance ofDomainFullJid.final booleanCheck if this is an instance ofEntityBareJid.final booleanCheck if this is an instance ofEntityFullJid.final booleanCheck if this is aEntityBareJidorEntityFullJid.final booleanisParentOf(Jid jid) Check if this JID is the parent of another JID.final booleanisStrictParentOf(Jid jid) Check if this JID is the strict parent of another JID.intlength()subSequence(int start, int end) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.CharSequence
chars, codePointsMethods 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:JidCheck if this is aEntityBareJidorEntityFullJid.- Specified by:
isEntityJidin interfaceJid- Returns:
- true if this is an instance of BareJid or FullJid.
-
isEntityBareJid
Description copied from interface:JidCheck if this is an instance ofEntityBareJid.- Specified by:
isEntityBareJidin interfaceJid- Returns:
- true if this is an instance of EntityBareJid
-
isEntityFullJid
Description copied from interface:JidCheck if this is an instance ofEntityFullJid.- Specified by:
isEntityFullJidin interfaceJid- Returns:
- true if this is an instance of EntityFullJid
-
isDomainBareJid
Description copied from interface:JidCheck if this is an instance ofDomainBareJid.- Specified by:
isDomainBareJidin interfaceJid- Returns:
- true if this is an instance of DomainBareJid
-
isDomainFullJid
Description copied from interface:JidCheck if this is an instance ofDomainFullJid.- Specified by:
isDomainFullJidin interfaceJid- Returns:
- true if this is an instance of DomainFullJid
-
hasNoResource
Description copied from interface:JidCheck if this is an instance ofEntityBareJidorDomainBareJid.- Specified by:
hasNoResourcein interfaceJid- Returns:
- true if this is an instance of BareJid or DomainBareJid
-
hasResource
Description copied from interface:JidCheck if this is a Jid with aResourcepart.- Specified by:
hasResourcein interfaceJid- Returns:
- true if this Jid has a resourcepart.
-
hasLocalpart
Description copied from interface:JidCheck if this is a Jid with aLocalpart.- Specified by:
hasLocalpartin interfaceJid- Returns:
- true if this Jid has a localpart.
-
downcast
Description copied from interface:JidReturn 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:
lengthin interfaceCharSequence
-
charAt
- Specified by:
charAtin interfaceCharSequence
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
asEntityBareJidOrThrow
Description copied from interface:JidConvert this Jid to aEntityBareJidor throw anIllegalStateExceptionif this is not possible.- Specified by:
asEntityBareJidOrThrowin interfaceJid- Returns:
- the corresponding
EntityBareJid.
-
asEntityFullJidOrThrow
Description copied from interface:JidConvert this Jid to aEntityFullJidor throw anIllegalStateExceptionif this is not possible.- Specified by:
asEntityFullJidOrThrowin interfaceJid- Returns:
- the corresponding
EntityFullJid.
-
asEntityJidOrThrow
Description copied from interface:JidConvert this Jid to aEntityJidor throw anIllegalStateExceptionif this is not possible.- Specified by:
asEntityJidOrThrowin interfaceJid- Returns:
- the corresponding
EntityJid.
-
asFullJidOrThrow
Description copied from interface:JidConvert this Jid to aFullJidor throw anIllegalStateExceptionif this is not possible.- Specified by:
asFullJidOrThrowin interfaceJid- Returns:
- the corresponding
FullJid.
-
asDomainFullJidOrThrow
Description copied from interface:JidConvert this Jid to aDomainFullJidor throw anIllegalStateExceptionif this is not possible.- Specified by:
asDomainFullJidOrThrowin interfaceJid- Returns:
- the corresponding
DomainFullJid.
-
getResourceOrNull
Description copied from interface:JidGet 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, thennullis returned.- Specified by:
getResourceOrNullin interfaceJid- Returns:
- the resource of this JID or null.
-
getResourceOrEmpty
Description copied from interface:JidGet 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.EMPTYis returned.- Specified by:
getResourceOrEmptyin interfaceJid- Returns:
- the resource of this JID or the empty resourcepart.
-
getResourceOrThrow
Description copied from interface:JidGet 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 anIllegalStateExceptionis thrown.- Specified by:
getResourceOrThrowin interfaceJid- Returns:
- the resource of this JID.
-
getLocalpartOrNull
Description copied from interface:JidGet 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, thennullis returned.- Specified by:
getLocalpartOrNullin interfaceJid- Returns:
- the localpart of this JID or null.
-
getLocalpartOrThrow
Description copied from interface:JidGet 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, thennullis returned.- Specified by:
getLocalpartOrThrowin interfaceJid- Returns:
- the localpart of this JID.
-
isParentOf
Description copied from interface:JidCheck 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:
isParentOfin 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:JidCheck 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:
isStrictParentOfin 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:JidCompares the given CharSequence with this JID. Returns true ifequals(charSequence.toString()would return true. -
equals
Description copied from interface:JidCompares 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:
compareToin interfaceComparable<Jid>
-
intern
Description copied from interface:JidReturns the canonical String representation of this JID. SeeString.intern()for details. -
asUrlEncodedString
Description copied from interface:JidGet the URL encoded version of this JID.- Specified by:
asUrlEncodedStringin interfaceJid- Returns:
- the URL encoded version of this JID.
-