public final class JID extends Object implements Comparable<JID>
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(JID o)
Method compares the
JID instance with a given object. |
JID |
copyWithoutResource()
The method returns a copy of the
JID instance with removed
resource part. |
JID |
copyWithResource(String resource)
The method returns a copy of the
JID instance with a different
resource part given as a parameter. |
JID |
copyWithResourceNS(String resource)
The method returns a copy of the
JID instance with a different
resource part given as a parameter. |
boolean |
equals(Object b)
Method compares whether this
JID instance represents the
same user JID as the one given in parameter. |
BareJID |
getBareJID()
Method returns
BareJID instance for this JID. |
String |
getDomain()
Method returns a domain part of the
JID instance. |
String |
getLocalpart()
Method a localpart (nickname) of the
JID instance. |
String |
getResource()
Method a resource part of the
JID instance. |
int |
hashCode()
Method returns a hash code calculated for the
JID instance. |
static JID |
jidInstance(BareJID bareJid)
Creates a new
JID instance using given BareJID
instance as a parameter. |
static JID |
jidInstance(BareJID bareJid,
String p_resource)
Constructs a new
JID instance using given BareJID
instance as user bare JID and String instance as a resource part. |
static JID |
jidInstance(String jid)
Constructs a new
JID instance using a JID parameter given
as a String instance. |
static JID |
jidInstance(String localpart,
String domain,
String resource)
Constructs a new
JID instance using given String
parameters. |
static JID |
jidInstanceNS(BareJID bareJid,
String p_resource)
Constructs a new
JID instance using given BareJID
instance as user bare JID and String instance as a resource part. |
static JID |
jidInstanceNS(String jid)
Constructs a new
JID instance using a JID parameter given
as a String instance. |
static JID |
jidInstanceNS(String localpart,
String domain,
String resource)
Constructs a new
JID instance using given String
parameters. |
String |
toString()
Method returns a
String representation of the
JID instance. |
public static JID jidInstance(BareJID bareJid, String p_resource) throws TigaseStringprepException
JID instance using given BareJID
instance as user bare JID and String instance as a resource part.
As the BareJID instances are immutable the constructor
doesn't create a copy of the given BareJID, instead it saves
the reference to a given object.bareJid - is a BareJID instance used to create the
JID instance.p_resource - is a String instance representing JID's
resource part.JID class instance.TigaseStringprepException - exception if there was an error during
stringprep processing.public static JID jidInstance(BareJID bareJid)
JID instance using given BareJID
instance as a parameter. The resource part is set to null.BareJID instances are immutable the constructor
doesn't create a copy of the given BareJID, instead it saves
the reference to a given object.bareJid - is a BareJID instance used to create the
JID instance.JID class instance.public static JID jidInstance(String jid) throws TigaseStringprepException
JID instance using a JID parameter given
as a String instance. The parameter is parsed, checked and
run through stringprep processing. An exception is thrown if there is
an error while the JID is checked.jid - a JID parameter given as a String instance.JID class instance.TigaseStringprepException - exception if there was an error during
stringprep processing.public static JID jidInstance(String localpart, String domain, String resource) throws TigaseStringprepException
JID instance using given String
parameters.
All the String parameters are parsed, checked and run through
the stringprep processing. In case of stringprep error, an exception is thrown.localpart - is a String instance representing JID's
localpart (nickname) part.domain - is a String instance representing JID's
domain part.resource - is a String instance representing JID's
resource part.JID class instance.TigaseStringprepException - exception if there was an error during
stringprep processing.public static JID jidInstanceNS(BareJID bareJid, String p_resource)
JID instance using given BareJID
instance as user bare JID and String instance as a resource part.
Note, this method does not perform stringprep processing on input
parameters.
As the BareJID instances are immutable the constructor
doesn't create a copy of the given BareJID, instead it saves
the reference to a given object.bareJid - is a BareJID instance used to create the
JID instance.p_resource - is a String instance representing JID's
resource part.JID class instance.public static JID jidInstanceNS(String jid)
JID instance using a JID parameter given
as a String instance.
Note, this method does not perform stringprep processing on input
parameters and it returns null if null is passed as parameter.
The method does not throw NullPointerException if the
String passed is null.jid - a JID parameter given as a String instance.JID class instance or null.public static JID jidInstanceNS(String localpart, String domain, String resource)
JID instance using given String
parameters.
Note, this method does not perform stringprep processing on input
parameters.
localpart - is a String instance representing JID's
localpart (nickname) part.domain - is a String instance representing JID's
domain part.resource - is a String instance representing JID's
resource part.JID class instance.public int compareTo(JID o)
JID instance with a given object.
The implementation fulfills the specification contract and returns a value
as you would expect from the call:
jid_1.toString().compareTo(jid_2.toString())
compareTo in interface Comparable<JID>o - is a JID instance to compare to.public JID copyWithResource(String resource) throws TigaseStringprepException
JID instance with a different
resource part given as a parameter.resource - is a String instance representing JID's
new resource part.JID class with a new resource
part.TigaseStringprepException - if resource stringprep processing fails.public JID copyWithResourceNS(String resource)
JID instance with a different
resource part given as a parameter.resource - is a String instance representing JID's
new resource part.JID class with a new resource
part.public JID copyWithoutResource()
JID instance with removed
resource part. The result is similar to the BareJID instance,
however there are APIs which require JID object to use.JID class with removed resource
part.public boolean equals(Object b)
JID instance represents the
same user JID as the one given in parameter. It returns
true of all: the localpart (nickname), domain part,
and the resource part are the same for both objects.public BareJID getBareJID()
BareJID instance for this JID.BareJID instance.public String getDomain()
JID instance.JID instance.public String getLocalpart()
JID instance.JID instance.public String getResource()
JID instance.JID instance.public int hashCode()
JID instance.Copyright © 2014 Tigase. All rights reserved.