Package org.jivesoftware.smack.roster
Class RosterGroup
java.lang.Object
org.jivesoftware.smack.Manager
org.jivesoftware.smack.roster.RosterGroup
public class RosterGroup
extends org.jivesoftware.smack.Manager
A group of roster entries.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddEntry(RosterEntry entry) Adds a roster entry to this group.booleancontains(RosterEntry entry) Returns true if the specified entry is part of this group.booleancontains(org.jxmpp.jid.Jid user) Returns true if the specified XMPP address is an entry in this group.Returns an copied list of all entries in the group.getEntry(org.jxmpp.jid.Jid user) Returns the roster entry associated with the given XMPP address ornullif the user is not an entry in the group.intReturns the number of entries in the group.getName()Returns the name of the group.voidremoveEntry(RosterEntry entry) Removes a roster entry from this group.voidSets the name of the group.Methods inherited from class org.jivesoftware.smack.Manager
connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
-
Method Details
-
getName
Returns the name of the group.- Returns:
- the name of the group.
-
setName
public void setName(String name) throws org.jivesoftware.smack.SmackException.NotConnectedException, org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, InterruptedException Sets the name of the group. Changing the group's name is like moving all the group entries of the group to a new group specified by the new name. Since this group won't have entries it will be removed from the roster. This means that all the references to this object will be invalid and will need to be updated to the new group specified by the new name.- Parameters:
name- the name of the group.- Throws:
org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.org.jivesoftware.smack.XMPPException.XMPPErrorException- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException- if there was no response from the remote entity.InterruptedException- if the calling thread was interrupted.
-
getEntryCount
public int getEntryCount()Returns the number of entries in the group.- Returns:
- the number of entries in the group.
-
getEntries
Returns an copied list of all entries in the group.- Returns:
- all entries in the group.
-
getEntry
Returns the roster entry associated with the given XMPP address ornullif the user is not an entry in the group.- Parameters:
user- the XMPP address of the user (e.g."jsmith@example.com").- Returns:
- the roster entry or
nullif it does not exist in the group.
-
contains
Returns true if the specified entry is part of this group.- Parameters:
entry- a roster entry.- Returns:
- true if the entry is part of this group.
-
contains
public boolean contains(org.jxmpp.jid.Jid user) Returns true if the specified XMPP address is an entry in this group.- Parameters:
user- the XMPP address of the user.- Returns:
- true if the XMPP address is an entry in this group.
-
addEntry
public void addEntry(RosterEntry entry) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException Adds a roster entry to this group. If the entry was unfiled then it will be removed from the unfiled list and will be added to this group. Note that this is a synchronous call -- Smack must wait for the server to receive the updated roster.- Parameters:
entry- a roster entry.- Throws:
org.jivesoftware.smack.XMPPException.XMPPErrorException- if an error occurred while trying to add the entry to the group.org.jivesoftware.smack.SmackException.NoResponseException- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-
removeEntry
public void removeEntry(RosterEntry entry) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException Removes a roster entry from this group. If the entry does not belong to any other group then it will be considered as unfiled, therefore it will be added to the list of unfiled entries. Note that this is a synchronous call -- Smack must wait for the server to receive the updated roster.- Parameters:
entry- a roster entry.- Throws:
org.jivesoftware.smack.XMPPException.XMPPErrorException- if an error occurred while trying to remove the entry from the group.org.jivesoftware.smack.SmackException.NoResponseException- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException- if the XMPP connection is not connected.InterruptedException- if the calling thread was interrupted.
-