1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-06 02:51:11 +01:00

add generics

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11422 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Michael Will 2009-11-26 14:11:19 +00:00 committed by michael.will
parent 0b7421eae3
commit 06805b248d
9 changed files with 52 additions and 51 deletions

View file

@ -50,7 +50,7 @@ public class AgentStatus implements PacketExtension {
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private String workgroupJID;
private List currentChats = new ArrayList();
private List<ChatInfo> currentChats = new ArrayList<ChatInfo>();
private int maxChats = -1;
AgentStatus() {
@ -67,7 +67,7 @@ public class AgentStatus implements PacketExtension {
* @return a collection of ChatInfo where each ChatInfo represents a Chat where this agent
* is participating.
*/
public List getCurrentChats() {
public List<ChatInfo> getCurrentChats() {
return Collections.unmodifiableList(currentChats);
}
@ -96,7 +96,7 @@ public class AgentStatus implements PacketExtension {
}
if (!currentChats.isEmpty()) {
buf.append("<current-chats xmlns= \"http://jivesoftware.com/protocol/workgroup\">");
for (Iterator it = currentChats.iterator(); it.hasNext();) {
for (Iterator<ChatInfo> it = currentChats.iterator(); it.hasNext();) {
buf.append(((ChatInfo)it.next()).toXML());
}
buf.append("</current-chats>");

View file

@ -47,17 +47,17 @@ public class AgentStatusRequest extends IQ {
*/
public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
private Set agents;
private Set<Item> agents;
public AgentStatusRequest() {
agents = new HashSet();
agents = new HashSet<Item>();
}
public int getAgentCount() {
return agents.size();
}
public Set getAgents() {
public Set<Item> getAgents() {
return Collections.unmodifiableSet(agents);
}
@ -73,7 +73,7 @@ public class AgentStatusRequest extends IQ {
StringBuilder buf = new StringBuilder();
buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">");
synchronized (agents) {
for (Iterator i=agents.iterator(); i.hasNext(); ) {
for (Iterator<Item> i=agents.iterator(); i.hasNext(); ) {
Item item = (Item) i.next();
buf.append("<agent jid=\"").append(item.getJID()).append("\">");
if (item.getName() != null) {

View file

@ -38,7 +38,7 @@ import java.util.List;
public class AgentWorkgroups extends IQ {
private String agentJID;
private List workgroups;
private List<String> workgroups;
/**
* Creates an AgentWorkgroups request for the given agent. This IQ will be sent and an answer
@ -48,7 +48,7 @@ public class AgentWorkgroups extends IQ {
*/
public AgentWorkgroups(String agentJID) {
this.agentJID = agentJID;
this.workgroups = new ArrayList();
this.workgroups = new ArrayList<String>();
}
/**
@ -58,7 +58,7 @@ public class AgentWorkgroups extends IQ {
* @param agentJID the id of the agent that can work in the list of workgroups.
* @param workgroups the list of workgroup JIDs where the agent can work.
*/
public AgentWorkgroups(String agentJID, List workgroups) {
public AgentWorkgroups(String agentJID, List<String> workgroups) {
this.agentJID = agentJID;
this.workgroups = workgroups;
}
@ -72,7 +72,7 @@ public class AgentWorkgroups extends IQ {
*
* @return a list of workgroup JIDs where the agent can work.
*/
public List getWorkgroups() {
public List<String> getWorkgroups() {
return Collections.unmodifiableList(workgroups);
}
@ -83,8 +83,8 @@ public class AgentWorkgroups extends IQ {
.append(agentJID)
.append("\">");
for (Iterator it=workgroups.iterator(); it.hasNext();) {
String workgroupJID = (String) it.next();
for (Iterator<String> it=workgroups.iterator(); it.hasNext();) {
String workgroupJID = it.next();
buf.append("<workgroup jid=\"" + workgroupJID + "\"/>");
}
@ -106,7 +106,7 @@ public class AgentWorkgroups extends IQ {
public IQ parseIQ(XmlPullParser parser) throws Exception {
String agentJID = parser.getAttributeValue("", "jid");
List workgroups = new ArrayList();
List<String> workgroups = new ArrayList<String>();
boolean done = false;
while (!done) {

View file

@ -51,13 +51,13 @@ public class QueueDetails implements PacketExtension {
/**
* The list of users in the queue.
*/
private Set users;
private Set<QueueUser> users;
/**
* Creates a new QueueDetails packet
*/
private QueueDetails() {
users = new HashSet();
users = new HashSet<QueueUser>();
}
/**
@ -76,7 +76,7 @@ public class QueueDetails implements PacketExtension {
*
* @return a Set for the users waiting in a queue.
*/
public Set getUsers() {
public Set<QueueUser> getUsers() {
synchronized (users) {
return users;
}
@ -106,7 +106,7 @@ public class QueueDetails implements PacketExtension {
buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">");
synchronized (users) {
for (Iterator i=users.iterator(); i.hasNext(); ) {
for (Iterator<QueueUser> i=users.iterator(); i.hasNext(); ) {
QueueUser user = (QueueUser)i.next();
int position = user.getQueuePosition();
int timeRemaining = user.getEstimatedRemainingTime();

View file

@ -36,7 +36,7 @@ import java.util.List;
*/
public class Transcript extends IQ {
private String sessionID;
private List packets;
private List<Packet> packets;
/**
* Creates a transcript request for the given sessionID.
@ -45,7 +45,7 @@ public class Transcript extends IQ {
*/
public Transcript(String sessionID) {
this.sessionID = sessionID;
this.packets = new ArrayList();
this.packets = new ArrayList<Packet>();
}
/**
@ -55,7 +55,7 @@ public class Transcript extends IQ {
* @param sessionID the id of the session that generated this conversation transcript.
* @param packets the list of messages and presences send to the room.
*/
public Transcript(String sessionID, List packets) {
public Transcript(String sessionID, List<Packet> packets) {
this.sessionID = sessionID;
this.packets = packets;
}
@ -75,7 +75,7 @@ public class Transcript extends IQ {
*
* @return the list of Messages and Presences that were sent to the room.
*/
public List getPackets() {
public List<Packet> getPackets() {
return Collections.unmodifiableList(packets);
}
@ -86,8 +86,8 @@ public class Transcript extends IQ {
.append(sessionID)
.append("\">");
for (Iterator it=packets.iterator(); it.hasNext();) {
Packet packet = (Packet) it.next();
for (Iterator<Packet> it=packets.iterator(); it.hasNext();) {
Packet packet = it.next();
buf.append(packet.toXML());
}

View file

@ -21,6 +21,7 @@ package org.jivesoftware.smackx.workgroup.packet;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Packet;
import org.jivesoftware.smack.util.PacketParserUtils;
import org.xmlpull.v1.XmlPullParser;
@ -40,7 +41,7 @@ public class TranscriptProvider implements IQProvider {
public IQ parseIQ(XmlPullParser parser) throws Exception {
String sessionID = parser.getAttributeValue("", "sessionID");
List packets = new ArrayList();
List<Packet> packets = new ArrayList<Packet>();
boolean done = false;
while (!done) {