org.jabber.jabberbeans
Class RosterItem
java.lang.Object
|
+--org.jabber.jabberbeans.XMLData
|
+--org.jabber.jabberbeans.RosterItem
- public class RosterItem
- extends XMLData
A RosterItem
is a single user item in Jabber. A roster item
contains the following information:
- JID: the Jabber Identifier of the subscribed resource. Usually people
subscribe to a user and not to a resource.
- Subscription Type: the type of subscription between the user specified
and the actual client. Can be 'none', 'to' (we receive their presence),
'from' (they receive our presence) or 'both'. A fifth, non-visible option
is 'remove', which is sent to delete a message and returned to indicate an
item has been removed and should be deleted from the local cache.
- Ask State: the user has a state associated, which can be 'none'
(default), 'subscribe', or 'unsubscribe'. This indicates there is a pending
request for subscription or unsubscription with the remote object.
- Name: a 'pretty' name, or nickname, for the user. This is what should
be displayed usually instead of a JID.
- Groups: one user can belong to many groups. Usually people will only put
a user in one group at a time, however. A list of groups can only be found
by getting the entire roster, and adding unique group names as the list is
parsed.
- Version:
- $Revision: 1.1.1.1 $
- Author:
- David Waite
<dwaite@jabber.com>, $Author: lucky $
- See Also:
Serializable
, Serialized Form
Field Summary |
private java.lang.String |
askStateType
The Asking State as described above |
private java.lang.String |
friendlyName
The 'Friendly Name' as described above |
private java.util.Vector |
groups
A vector of groups associated with this item, as described above |
private JID |
jid
The JID as described above |
private java.lang.String |
subscriptionType
The Subscription Type as described above |
Method Summary |
void |
appendItem(java.lang.StringBuffer sb)
appendItem outputs an XML-style representation of the
current roster item, appending it to a Stringbuffer. |
java.util.Enumeration |
enumerateGroups()
enumerateGroups enumerates the group(s) which the user
is entered. |
java.lang.String |
getFriendlyName()
getFriendlyName returns the 'friendly name' associated with
this roster item |
JID |
getJID()
getJID gets the JID contained in this roster element |
java.lang.String |
getSubscriptionType()
getSubscriptionType gets the subscription type of this
roster element |
java.lang.String |
getWaitingStateType()
getWaitingStateType returns a state that you are waiting
for, such as 'subscribe' (waiting for other user to approve your
subscription). |
Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
jid
private JID jid
- The JID as described above
subscriptionType
private java.lang.String subscriptionType
- The Subscription Type as described above
askStateType
private java.lang.String askStateType
- The Asking State as described above
friendlyName
private java.lang.String friendlyName
- The 'Friendly Name' as described above
groups
private java.util.Vector groups
- A vector of groups associated with this item, as described above
RosterItem
public RosterItem(RosterItemBuilder builder)
throws java.lang.InstantiationException
- Creates a new
RosterItem
instance based on the builder
being passed in
- Parameters:
builder
- a valid RosterItemBuilder
- Throws:
- java.lang.InstantiationException - if an error occurs
getJID
public JID getJID()
getJID
gets the JID contained in this roster element
- Returns:
- a
JID
value
getSubscriptionType
public java.lang.String getSubscriptionType()
getSubscriptionType
gets the subscription type of this
roster element
- Returns:
String
holding subscription type, or null if none
specified.
getWaitingStateType
public java.lang.String getWaitingStateType()
getWaitingStateType
returns a state that you are waiting
for, such as 'subscribe' (waiting for other user to approve your
subscription). This value is not directly changable by clients.
- Returns:
- a
String
value, with null representing 'none'.
getFriendlyName
public java.lang.String getFriendlyName()
getFriendlyName
returns the 'friendly name' associated with
this roster item
- Returns:
- a
String
value, or null if no friendly name was
specified
enumerateGroups
public java.util.Enumeration enumerateGroups()
enumerateGroups
enumerates the group(s) which the user
is entered. If no groups are specified or an 'empty' group is
specified, the user is on the top level.
- Returns:
- an
Enumeration
value
appendItem
public void appendItem(java.lang.StringBuffer sb)
appendItem
outputs an XML-style representation of the
current roster item, appending it to a Stringbuffer.
- Overrides:
- appendItem in class XMLData
- Returns:
StringBuffer
with XML