This repository has been archived on 2021-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
envoy/src/main/java/envoy/data/Group.java

68 lines
1.6 KiB
Java
Raw Normal View History

package envoy.data;
import java.util.ArrayList;
import java.util.List;
import java.util.StringJoiner;
/**
* Project: <strong>envoy-common</strong><br>
* File: <strong>Group.java</strong><br>
* Created: <strong>24 Mar 2020</strong><br>
*
* @author Leon Hofmeister
* @since Envoy Common v0.1-beta
*/
public class Group extends Contact {
private static final long serialVersionUID = 0L;
// TODO add admins
2020-03-24 21:57:59 +01:00
private List<Long> memberIDs;
/**
* Creates a new instance of a {@link Group}.
*
* @param id the id of this group
* @param name the name of this group
* @since Envoy Common v0.1-beta
*/
2020-03-24 21:57:59 +01:00
public Group(long id, String name) { this(id, name, new ArrayList<>()); }
/**
* Creates a new instance of a {@link Group}.
*
* @param id the id of this group
* @param name the name of this group
* @param memberIDs the IDs of all members that should be preinitialized
* @since Envoy Common v0.1-beta
*/
public Group(long id, String name, List<Long> memberIDs) {
super(id, name);
this.memberIDs = memberIDs;
}
/**
* @return the IDs of all members of this group
* @since Envoy Common v0.1-beta
*/
public List<Long> getMemberIDs() { return memberIDs; }
/**
* @param memberIDs the member IDs to set
* @since Envoy Common v0.1-beta
*/
public void setMemberIDs(List<Long> memberIDs) { this.memberIDs = memberIDs; }
/**
* {@inheritDoc}
*/
@Override
public String toString() {
var joiner = new StringJoiner(",", "Group[id=", "]");
joiner.add("id=" + getID());
joiner.add("name=" + getName());
joiner.add("memberIDs=" + getMemberIDs());
return joiner.toString();
}
}