Class MalformedJid
- java.lang.Object
-
- rocks.xmpp.addr.MalformedJid
-
- All Implemented Interfaces:
Serializable,CharSequence,Comparable<Jid>,Jid
public final class MalformedJid extends Object
Represents a malformed JID in order to handle thejid-malformederror.This class is not intended to be publicly instantiable, but is used for malformed JIDs during parsing automatically.
- See Also:
- RFC 6120, 8.3.3.8. jid-malformed, Serialized Form
-
-
Field Summary
-
Fields inherited from interface rocks.xmpp.addr.Jid
ESCAPING_FEATURE, MAX_BARE_JID_LENGTH, MAX_FULL_JID_LENGTH
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JidasBareJid()Gets the bare JID representation of this JID, i.e. removes the resource part.JidatSubdomain(CharSequence subdomain)Creates a new JID at a subdomain and at the same domain as this JID.charcharAt(int index)intcompareTo(Jid o)Compares this JID with another JID.booleanequals(Object o)ThrowablegetCause()Gets the cause why the JID is malformed.StringgetDomain()Gets the domain part.StringgetEscapedLocal()Gets the escaped local part of the JID.StringgetLocal()Gets the local part of the JID, also known as the name or node.StringgetResource()Gets the resource part.inthashCode()booleanisBareJid()Checks if the JID is a bare JID.booleanisDomainJid()Checks if the JID is a domain JID, i.e. if it has no local part.booleanisFullJid()Checks if the JID is a full JID.intlength()CharSequencesubSequence(int start, int end)StringtoEscapedString()Returns the JID in escaped form as described in XEP-0106: JID Escaping.StringtoString()Returns the JID in its string representation, i.e. [ localpart "@" ] domainpart [ "/" resourcepart ].JidwithLocal(CharSequence local)Creates a new JID with a new local part and the same domain and resource part of the current JID.JidwithResource(CharSequence resource)Creates a new full JID with a resource and the same local and domain part of the current JID.-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Method Detail
-
asBareJid
public final Jid asBareJid()
Description copied from interface:JidGets the bare JID representation of this JID, i.e. removes the resource part.The term "bare JID" refers to an XMPP address of the form <localpart@domainpart> (for an account at a server) or of the form <domainpart> (for a server).
- Returns:
- The bare JID.
- See Also:
Jid.withResource(CharSequence)
-
withLocal
public Jid withLocal(CharSequence local)
Description copied from interface:JidCreates a new JID with a new local part and the same domain and resource part of the current JID.- Parameters:
local- The local part.- Returns:
- The JID with a new local part.
- See Also:
Jid.withResource(CharSequence)
-
withResource
public Jid withResource(CharSequence resource)
Description copied from interface:JidCreates a new full JID with a resource and the same local and domain part of the current JID.- Parameters:
resource- The resource.- Returns:
- The full JID with a resource.
- See Also:
Jid.asBareJid(),Jid.withLocal(CharSequence)
-
atSubdomain
public Jid atSubdomain(CharSequence subdomain)
Description copied from interface:JidCreates a new JID at a subdomain and at the same domain as this JID.- Parameters:
subdomain- The subdomain.- Returns:
- The JID at a subdomain.
-
getLocal
public final String getLocal()
Description copied from interface:JidGets the local part of the JID, also known as the name or node.The localpart of a JID is an optional identifier placed before the domainpart and separated from the latter by the '@' character. Typically, a localpart uniquely identifies the entity requesting and using network access provided by a server (i.e., a local account), although it can also represent other kinds of entities (e.g., a chatroom associated with a multi-user chat service [XEP-0045]). The entity represented by an XMPP localpart is addressed within the context of a specific domain (i.e., <localpart@domainpart>).
- Returns:
- The local part or null.
- See Also:
Jid.getEscapedLocal()
-
getEscapedLocal
public final String getEscapedLocal()
Description copied from interface:JidGets the escaped local part of the JID.- Returns:
- The escaped local part or null.
- See Also:
Jid.getLocal()
-
getDomain
public final String getDomain()
Description copied from interface:JidGets the domain part.The domainpart is the primary identifier and is the only REQUIRED element of a JID (a mere domainpart is a valid JID). Typically, a domainpart identifies the "home" server to which clients connect for XML routing and data management functionality.
- Returns:
- The domain part.
-
getResource
public final String getResource()
Description copied from interface:JidGets the resource part.The resourcepart of a JID is an optional identifier placed after the domainpart and separated from the latter by the '/' character. A resourcepart can modify either a <localpart@domainpart> address or a mere <domainpart> address. Typically, a resourcepart uniquely identifies a specific connection (e.g., a device or location) or object (e.g., an occupant in a multi-user chatroom [XEP-0045]) belonging to the entity associated with an XMPP localpart at a domain (i.e., <localpart@domainpart/resourcepart>).
- Returns:
- The resource part or null.
-
getCause
public final Throwable getCause()
Gets the cause why the JID is malformed.- Returns:
- The cause.
-
isFullJid
public final boolean isFullJid()
Checks if the JID is a full JID.The term "full JID" refers to an XMPP address of the form <localpart@domainpart/resourcepart> (for a particular authorized client or device associated with an account) or of the form <domainpart/resourcepart> (for a particular resource or script associated with a server).
-
isBareJid
public final boolean isBareJid()
Checks if the JID is a bare JID.The term "bare JID" refers to an XMPP address of the form <localpart@domainpart> (for an account at a server) or of the form <domainpart> (for a server).
-
isDomainJid
public final boolean isDomainJid()
Description copied from interface:JidChecks if the JID is a domain JID, i.e. if it has no local part.- Specified by:
isDomainJidin interfaceJid- Returns:
- True, if the JID is a domain JID, i.e. if it has no local part.
-
compareTo
public final int compareTo(Jid o)
Compares this JID with another JID. First domain parts are compared. If these are equal, local parts are compared and if these are equal, too, resource parts are compared.- Specified by:
compareToin interfaceComparable<Jid>- Parameters:
o- The other JID.- Returns:
- The comparison result.
-
length
public final int length()
- Specified by:
lengthin interfaceCharSequence
-
charAt
public final char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public final CharSequence subSequence(int start, int end)
- Specified by:
subSequencein interfaceCharSequence
-
toString
public final String toString()
Returns the JID in its string representation, i.e. [ localpart "@" ] domainpart [ "/" resourcepart ].- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject- Returns:
- The JID.
- See Also:
Jid.toEscapedString()
-
toEscapedString
public final String toEscapedString()
Description copied from interface:JidReturns the JID in escaped form as described in XEP-0106: JID Escaping.- Specified by:
toEscapedStringin interfaceJid- Returns:
- The escaped JID.
- See Also:
CharSequence.toString()
-
-