ALso have variable as STATE which will be having values as:-
SEEN, SENT, etc..
This will help in tracking of message and also launch a threads which will keep on checking whether messages which don't have status as SENT/ RECEIVED just resend them
题
I'm building an IM program using java IO, and I have an Object called Message. what field do you recommend me to add to Message Class? I did the folowing:
public class Message implements Serializable {
static private final long serialVersionUID=12525452;
enum commands{
LEAVE,
ONLINELISTREQUEST,
SENT,
DELIVERED,
READ;
}
enum types{
TEXT,
VEDIO,
PICTURE,
AUDIO,
COMMAND,
//...... what to add??
}
// fields..
private String From;
private String To;
private String Body;
private int type;
private String url;
private int command;
//what to add??
解决方案
ALso have variable as STATE which will be having values as:-
SEEN, SENT, etc..
This will help in tracking of message and also launch a threads which will keep on checking whether messages which don't have status as SENT/ RECEIVED just resend them
其他提示
Just use the teachings of Object Oriented concepts. A class should have attributes that are really properties of the entity represented by that class.