Smack

org.jivesoftware.smack
Class RosterGroup

java.lang.Object
  extended by org.jivesoftware.smack.RosterGroup

public class RosterGroup
extends java.lang.Object

A group of roster entries.

Author:
Matt Tucker
See Also:
Roster.getGroup(String)

Method Summary
 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(java.lang.String user)
          Returns true if the specified XMPP address is an entry in this group.
 java.util.Collection<RosterEntry> getEntries()
          Returns an unmodifiable collection of all entries in the group.
 RosterEntry getEntry(java.lang.String 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 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)
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.

getEntryCount

public int getEntryCount()
Returns the number of entries in the group.

Returns:
the number of entries in the group.

getEntries

public java.util.Collection<RosterEntry> getEntries()
Returns an unmodifiable collection of all entries in the group.

Returns:
all entries in the group.

getEntry

public RosterEntry getEntry(java.lang.String 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 "jsmith@example.com").
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(java.lang.String 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 XMPPException
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 an asynchronous call -- Smack must wait for the server to receive the updated roster.

Parameters:
entry - a roster entry.
Throws:
XMPPException - if an error occured while trying to add the entry to the group.

removeEntry

public void removeEntry(RosterEntry entry)
                 throws XMPPException
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 an asynchronous call -- Smack must wait for the server to receive the updated roster.

Parameters:
entry - a roster entry.
Throws:
XMPPException - if an error occured while trying to remove the entry from the group.

Smack

Copyright © 2003-2007 Jive Software.