com.uchicom.smtp.Context Maven / Gradle / Ivy
// (c) 2016 uchicom
package com.uchicom.smtp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Context {
private static final Context context = new Context();
private Context() {
}
public static Context singleton() {
return context;
}
/** ユーザー名一覧 */
private String[] users;
private Map> boxMap;
public String[] getUsers() {
return users;
}
public void setUsers(String[] users) {
this.users = users;
boxMap = new HashMap<>();
for (String user : users) {
boxMap.put(user, new ArrayList());
}
}
public void addMail(String user, Mail mail) {
boxMap.get(user).add(mail);
}
public List getMailList(String user) {
if (boxMap != null) {
return boxMap.get(user);
}
return null;
}
public Map> getBoxMap() {
return boxMap;
}
public void setBoxMap(Map> boxMap) {
this.boxMap = boxMap;
}
}