Class AbstractJid
- java.lang.Object
-
- org.jxmpp.jid.impl.AbstractJid
-
- All Implemented Interfaces:
Serializable,CharSequence,Comparable<Jid>,Jid
- Direct Known Subclasses:
DomainAndResourcepartJid,DomainpartJid,LocalAndDomainpartJid,LocalDomainAndResourcepartJid
public abstract class AbstractJid extends Object implements Jid
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AbstractJid()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description DomainFullJidasDomainFullJidOrThrow()Convert this Jid to aDomainFullJidor throw anIllegalStateExceptionif this is not possible.EntityBareJidasEntityBareJidOrThrow()Convert this Jid to aEntityBareJidor throw anIllegalStateExceptionif this is not possible.EntityFullJidasEntityFullJidOrThrow()Convert this Jid to aEntityFullJidor throw anIllegalStateExceptionif this is not possible.EntityJidasEntityJidOrThrow()Convert this Jid to aEntityJidor throw anIllegalStateExceptionif this is not possible.EntityFullJidasFullJidOrThrow()Convert this Jid to aFullJidor throw anIllegalStateExceptionif this is not possible.StringasUrlEncodedString()Get the URL encoded version of this JID.charcharAt(int index)intcompareTo(Jid other)<T extends Jid>
Tdowncast(Class<T> jidClass)Return the downcasted instance of this Jid.booleanequals(CharSequence charSequence)Compares the given CharSequence with this JID.booleanequals(Object other)booleanequals(String string)Compares the given String wit this JID.abstract LocalpartgetLocalpartOrNull()Get the localpart of this JID or null.LocalpartgetLocalpartOrThrow()Get the localpart of this JID or throw anIllegalStateException.ResourcepartgetResourceOrEmpty()Get the resourcepart of this JID or return the empty resourcepart.abstract ResourcepartgetResourceOrNull()Get the resourcepart of this JID or null.ResourcepartgetResourceOrThrow()Get the resourcepart of this JID or throw anIllegalStateException.inthashCode()booleanhasLocalpart()Check if this is a Jid with aLocalpart.abstract booleanhasNoResource()Check if this is an instance ofEntityBareJidorDomainBareJid.booleanhasResource()Check if this is a Jid with aResourcepart.Stringintern()Returns the canonical String representation of this JID.booleanisDomainBareJid()Check if this is an instance ofDomainBareJid.booleanisDomainFullJid()Check if this is an instance ofDomainFullJid.booleanisEntityBareJid()Check if this is an instance ofEntityBareJid.booleanisEntityFullJid()Check if this is an instance ofEntityFullJid.booleanisEntityJid()Check if this is aEntityBareJidorEntityFullJid.booleanisParentOf(Jid jid)Check if this JID is the parent of another JID.intlength()CharSequencesubSequence(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, toString
-
-
-
-
Constructor Detail
-
AbstractJid
public AbstractJid()
-
-
Method Detail
-
isEntityJid
public final boolean 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
public final boolean 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
public final boolean 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
public final boolean 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
public final boolean 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
public abstract boolean 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
public final boolean 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
public final boolean 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
public final <T extends Jid> T downcast(Class<T> jidClass)
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
public int length()
- Specified by:
lengthin interfaceCharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public CharSequence subSequence(int start, int end)
- Specified by:
subSequencein interfaceCharSequence
-
asEntityBareJidOrThrow
public final EntityBareJid 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
public EntityFullJid 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
public EntityJid 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
public EntityFullJid 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
public DomainFullJid 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
public abstract Resourcepart 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
public final Resourcepart 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
public final 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
public abstract Localpart 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
public final Localpart 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
public final boolean isParentOf(Jid jid)
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.
-
equals
public final boolean equals(CharSequence charSequence)
Description copied from interface:JidCompares the given CharSequence with this JID. Returns true ifequals(charSequence.toString()would return true.- Specified by:
equalsin interfaceJid- Parameters:
charSequence- the CharSequence to compare this JID with.- Returns:
- true if if
equals(charSequence.toString()would return true. - See Also:
Jid.equals(String)
-
equals
public final boolean equals(String string)
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
public final int compareTo(Jid other)
- Specified by:
compareToin interfaceComparable<Jid>
-
intern
public final String intern()
Description copied from interface:JidReturns the canonical String representation of this JID. SeeString.intern()for details.
-
asUrlEncodedString
public final String 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.
-
-