|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jabber.jabberbeans.util.JID
A JID
is a jabber identifier, signifying a resource in the
Jabber protocol.
Format:
[User@]server[/resource]
Constructor Summary | |
JID(java.lang.String server)
Creates a new JID instance, with only a server being
specified. |
|
JID(java.lang.String username,
java.lang.String server,
java.lang.String resource)
Creates a new JID instance, based on the server and user
and resource strings. |
Method Summary | |
int |
compare(java.lang.Object o)
compare returns true if these objects are equivalent. |
static int |
compare(java.lang.Object o,
java.lang.Object o2)
compare returns true if these objects are equivalent. |
int |
compareTo(java.lang.Object o)
compareTo returns true if these objects are equivalent. |
boolean |
equals(JID u)
equals returns true if these objects are equivalent. |
boolean |
equals(java.lang.Object obj)
equals returns true if these objects are equivalent. |
static JID |
fromString(java.lang.String input)
fromString is a static method that creates a new JID based
on an input string in URI format. |
java.lang.String |
getResource()
Returns the resource if one was specified, otherwise null |
java.lang.String |
getServer()
Returns the server name of the JID |
JID |
getSimpleJID()
getSimpleJID returns the current jid without the resource |
java.lang.String |
getUsername()
Returns the username of the JID if one was specified, othewise null |
int |
hashCode()
hashCode returns the hash code of the jid in lowercase |
java.lang.String |
normalize()
normalize returns a normalized string,
This means that the username and server have been lowercased and the
resource remains the same |
static java.lang.String |
normalize(JID j)
normalize returns a normalized string from the jid taken
This means that the username and server have been lowercased and the
resource remains the same |
java.lang.String |
toPrettyString()
Deprecated. use toSimpleString() instead, will
be removed before 1.0 |
java.lang.String |
toSimpleString()
toSimpleString returns a string of the current jid
sans(minus) the resource |
java.lang.String |
toString()
Creates a string representing the JID. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JID(java.lang.String server)
JID
instance, with only a server being
specified.
server
- String
naming the server.
java.lang.RuntimeException
- if the server field is null, as that
would be an invalid JID.public JID(java.lang.String username, java.lang.String server, java.lang.String resource)
JID
instance, based on the server and user
and resource strings. the Username and Resource can optionally be set
to null.
username
- String
value holding the username, or nullserver
- String
value holding the server nameresource
- String
value holding the resource, or null
java.lang.RuntimeException
- if the server field is null (as that would be
an invalid JID)Method Detail |
public static JID fromString(java.lang.String input)
fromString
is a static method that creates a new JID based
on an input string in URI format.
input
- String
value containing a URI JID
JID
value if we can parse this into a JID, null
otherwisepublic java.lang.String getUsername()
String
holding the username, or nullpublic java.lang.String getServer()
String
holding the server namepublic java.lang.String getResource()
String
holding the resource name, or nullpublic JID getSimpleJID()
getSimpleJID
returns the current jid without the resource
JID
valuepublic java.lang.String toString()
toString
in class java.lang.Object
String
value representing the JID.public java.lang.String toPrettyString()
toSimpleString()
instead, will
be removed before 1.0
String
valuepublic java.lang.String toSimpleString()
toSimpleString
returns a string of the current jid
sans(minus) the resource
String
valuepublic boolean equals(JID u)
equals
returns true if these objects are equivalent.
It takes into account that usernames and servers are case-insensitive,
and that resources are case sensitive. It also takes into account that
usernames and resources are optional, but requires them to be specified
in both or none of the two JIDs being compared.
u
- a JID
we are comparing to this one
boolean
that is true when the JIDs are equivalentpublic boolean equals(java.lang.Object obj)
equals
returns true if these objects are equivalent.
It takes into account that usernames and servers are case-insensitive,
and that resources are case sensitive. It also takes into account that
usernames and resources are optional, but requires them to be specified
in both or none of the two JIDs being compared.
equals
in class java.lang.Object
obj
- a Object
we are comparing to this one
boolean
that is true when the objects are equivalentpublic int compareTo(java.lang.Object o)
compareTo
returns true if these objects are equivalent.
It takes into account that usernames and servers are case-insensitive,
and that resources are case sensitive. It also takes into account that
usernames and resources are optional, but requires them to be specified
in both or none of the two JIDs being compared.
compareTo
in interface java.lang.Comparable
int
that determines lexographical significancepublic int compare(java.lang.Object o)
compare
returns true if these objects are equivalent.
It takes into account that usernames and servers are case-insensitive,
and that resources are case sensitive. It also takes into account that
usernames and resources are optional, but requires them to be specified
in both or none of the two JIDs being compared.
int
that determines lexographical significancepublic static int compare(java.lang.Object o, java.lang.Object o2)
compare
returns true if these objects are equivalent.
It takes into account that usernames and servers are case-insensitive,
and that resources are case sensitive. It also takes into account that
usernames and resources are optional, but requires them to be specified
in both or none of the two JIDs being compared.
int
that determines lexographical significancepublic int hashCode()
hashCode
returns the hash code of the jid in lowercase
hashCode
in class java.lang.Object
int
that is the hash codepublic static java.lang.String normalize(JID j)
normalize
returns a normalized string from the jid taken
This means that the username and server have been lowercased and the
resource remains the same
String
that is normalizedpublic java.lang.String normalize()
normalize
returns a normalized string,
This means that the username and server have been lowercased and the
resource remains the same
String
that is normalized
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |