mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
Javadoc fixes.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@1851 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
6b472c6145
commit
9287e1b989
4 changed files with 86 additions and 8 deletions
|
@ -58,7 +58,8 @@ import org.jivesoftware.smack.filter.*;
|
|||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Roster.
|
||||
* Represents a user's roster, which is the collection of users a person receives
|
||||
* presence updates for. Roster items are categorized into groups for easier management.
|
||||
*
|
||||
* @see XMPPConnection#getRoster()
|
||||
* @author Matt Tucker
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
* ====================================================================
|
||||
*/
|
||||
|
||||
|
||||
package org.jivesoftware.smack;
|
||||
|
||||
import org.jivesoftware.smack.packet.RosterPacket;
|
||||
|
@ -59,6 +58,7 @@ import org.jivesoftware.smack.packet.IQ;
|
|||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A group of roster entries.
|
||||
*
|
||||
* @see Roster#getGroup(String)
|
||||
* @author Matt Tucker
|
||||
|
|
|
@ -63,12 +63,22 @@ public class RosterPacket extends IQ {
|
|||
|
||||
private List rosterItems = new ArrayList();
|
||||
|
||||
public void addRosterItem(Item entry) {
|
||||
/**
|
||||
* Adds a roster item to the packet.
|
||||
*
|
||||
* @param item a roster item.
|
||||
*/
|
||||
public void addRosterItem(Item item) {
|
||||
synchronized (rosterItems) {
|
||||
rosterItems.add(entry);
|
||||
rosterItems.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator for the roster items in the packet.
|
||||
*
|
||||
* @return and Iterator for the roster items in the packet.
|
||||
*/
|
||||
public Iterator getRosterItems() {
|
||||
synchronized (rosterItems) {
|
||||
List entries = Collections.unmodifiableList(new ArrayList(rosterItems));
|
||||
|
@ -89,6 +99,10 @@ public class RosterPacket extends IQ {
|
|||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* A roster item, which consists of a JID, their name, the type of subscription, and
|
||||
* the groups the roster item belongs to.
|
||||
*/
|
||||
public static class Item {
|
||||
|
||||
private String user;
|
||||
|
@ -96,6 +110,12 @@ public class RosterPacket extends IQ {
|
|||
private ItemType itemType;
|
||||
private List groupNames;
|
||||
|
||||
/**
|
||||
* Creates a new roster item.
|
||||
*
|
||||
* @param user the user.
|
||||
* @param name the user's name.
|
||||
*/
|
||||
public Item(String user, String name) {
|
||||
this.user = user;
|
||||
this.name = name;
|
||||
|
@ -103,32 +123,68 @@ public class RosterPacket extends IQ {
|
|||
groupNames = new ArrayList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user.
|
||||
*
|
||||
* @return the user.
|
||||
*/
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the user's name.
|
||||
*
|
||||
* @return the user's name.
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the user's name.
|
||||
*
|
||||
* @param name the user's name.
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the roster item type.
|
||||
*
|
||||
* @return the roster item type.
|
||||
*/
|
||||
public ItemType getItemType() {
|
||||
return itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the roster item type.
|
||||
*
|
||||
* @param itemType the roster item type.
|
||||
*/
|
||||
public void setItemType(ItemType itemType) {
|
||||
this.itemType = itemType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Iterator for the group names (as Strings) that the roster item
|
||||
* belongs to.
|
||||
*
|
||||
* @return an Iterator for the group names.
|
||||
*/
|
||||
public Iterator getGroupNames() {
|
||||
synchronized (groupNames) {
|
||||
return Collections.unmodifiableList(groupNames).iterator();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a group name.
|
||||
*
|
||||
* @param groupName the group name.
|
||||
*/
|
||||
public void addGroupName(String groupName) {
|
||||
synchronized (groupNames) {
|
||||
if (!groupNames.contains(groupName)) {
|
||||
|
@ -137,6 +193,11 @@ public class RosterPacket extends IQ {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a group name.
|
||||
*
|
||||
* @param groupName the group name.
|
||||
*/
|
||||
public void removeGroupName(String groupName) {
|
||||
synchronized (groupNames) {
|
||||
groupNames.remove(groupName);
|
||||
|
@ -164,6 +225,9 @@ public class RosterPacket extends IQ {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The subscription status of a roster item.
|
||||
*/
|
||||
public static class ItemStatus {
|
||||
|
||||
public static final ItemStatus SUBSCRIBED = new ItemStatus("subscribed");
|
||||
|
@ -184,6 +248,11 @@ public class RosterPacket extends IQ {
|
|||
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* Returns the item status associated with the specified string.
|
||||
*
|
||||
* @param value the item status.
|
||||
*/
|
||||
private ItemStatus(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
@ -194,6 +263,9 @@ public class RosterPacket extends IQ {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* The subscription type of a roster item.
|
||||
*/
|
||||
public static class ItemType {
|
||||
|
||||
public static final ItemType NONE = new ItemType("none");
|
||||
|
@ -221,6 +293,11 @@ public class RosterPacket extends IQ {
|
|||
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* Returns the item type associated with the specified string.
|
||||
*
|
||||
* @param value the item type.
|
||||
*/
|
||||
public ItemType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@
|
|||
package org.jivesoftware.smack.packet;
|
||||
|
||||
/**
|
||||
* Represents a XMPP error subpacket. Typically, a server responds to a request that has
|
||||
* Represents a XMPP error sub-packet. Typically, a server responds to a request that has
|
||||
* problems by sending the packet back and including an error packet. Each error has a code
|
||||
* as well as as an optional text explanation. Typical error codes are as follows:
|
||||
* as well as as an optional text explanation. Typical error codes are as follows:<p>
|
||||
*
|
||||
* <table border=1>
|
||||
* <tr><td><b>Code</b></td><td><b>Description</b></td></tr>
|
||||
|
|
Loading…
Reference in a new issue