Class RosterGroup


  • public class RosterGroup
    extends org.jivesoftware.smack.Manager
    A group of roster entries.
    See Also:
    Roster.getGroup(String)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addEntry​(RosterEntry entry)
      Adds a roster entry to this group.
      boolean contains​(RosterEntry entry)
      Returns true if the specified entry is part of this group.
      boolean contains​(org.jxmpp.jid.Jid user)
      Returns true if the specified XMPP address is an entry in this group.
      java.util.List<RosterEntry> getEntries()
      Returns an copied list of all entries in the group.
      RosterEntry getEntry​(org.jxmpp.jid.Jid user)
      Returns the roster entry associated with the given XMPP address or null if the user is not an entry in the group.
      int getEntryCount()
      Returns the number of entries in the group.
      java.lang.String getName()
      Returns the name of the group.
      void removeEntry​(RosterEntry entry)
      Removes a roster entry from this group.
      void setName​(java.lang.String name)
      Sets the name of the group.
      • Methods inherited from class org.jivesoftware.smack.Manager

        connection, getAuthenticatedConnectionOrThrow, schedule, schedule, scheduleBlocking
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the group.
        Returns:
        the name of the group.
      • setName

        public void setName​(java.lang.String name)
                     throws org.jivesoftware.smack.SmackException.NotConnectedException,
                            org.jivesoftware.smack.SmackException.NoResponseException,
                            org.jivesoftware.smack.XMPPException.XMPPErrorException,
                            java.lang.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.
        java.lang.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

        public java.util.List<RosterEntry> getEntries()
        Returns an copied list of all entries in the group.
        Returns:
        all entries in the group.
      • getEntry

        public RosterEntry getEntry​(org.jxmpp.jid.Jid user)
        Returns the roster entry associated with the given XMPP address or null if the user is not an entry in the group.
        Parameters:
        user - the XMPP address of the user (eg "[email protected]").
        Returns:
        the roster entry or null if it does not exist in the group.
      • contains

        public boolean contains​(RosterEntry entry)
        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,
                             java.lang.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.
        java.lang.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,
                                java.lang.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.
        java.lang.InterruptedException - if the calling thread was interrupted.