/** * * Copyright 2003-2007 Jive Software. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jivesoftware.smackx.xroster; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.jxmpp.jid.Jid; /** * Represents a roster item, which consists of a JID and , their name and * the groups the roster item belongs to. This roster item does not belong * to the local roster. Therefore, it does not persist in the server.
*
* The idea of a RemoteRosterEntry is to be used as part of a roster exchange.
*
* @author Gaston Dombiak
*/
public class RemoteRosterEntry {
private final Jid user;
private final String name;
private final Listnull
if the
* the roster entry won't belong to a group.
*/
public RemoteRosterEntry(Jid user, String name, String[] groups) {
this.user = user;
this.name = name;
if (groups != null) {
groupNames.addAll(Arrays.asList(groups));
}
}
/**
* Returns the user.
*
* @return the user.
*/
public Jid getUser() {
return user;
}
/**
* Returns the user's name.
*
* @return the user's name.
*/
public String getName() {
return name;
}
/**
* Returns an Iterator for the group names (as Strings) that the roster entry
* belongs to.
*
* @return an Iterator for the group names.
*/
public Iterator