|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.java4less.sms.SmsMessage
Generic class for SMS Messages.
This class has several uses:
- store message fields before and after it is sent through a gateway.
- get its delivery status
As this a generic base class it does not perform validity checks.
Validity checks may be performed by subclasses of this one or by
the SMS gateway class.
Field Summary | |
static int |
ACCEPTED
SMS Gateway accepted message. |
static int |
DOUBTFUL
In TAP protocol : Initially accepted but not confirmed. |
static int |
GATEWAY_ERROR
Last try to connect to the SMS gateway to deliver this message failed. |
static int |
PENDING
Initial Message status before trying to deliver it |
static int |
REJECTED
SMS Gateway rejected message. |
Constructor Summary | |
SmsMessage()
Creates an empty message. |
|
SmsMessage(java.lang.String recipient,
java.lang.String text)
Creates a message with the minimum fields set. |
Method Summary | |
java.lang.String |
getRecipient()
see setRecipient(java.lang.String) |
java.lang.String |
getStatusText()
see setStatus(int status, String text) |
java.lang.String |
getText()
see setText |
boolean |
isAccepted()
true if message status is ACCEPTED |
boolean |
isDoubtful()
true if message status is DOUBTFUL |
boolean |
isGatewayError()
true if message status is GATEWAY_ERROR |
boolean |
isPending()
true if message status is PENDING |
boolean |
isRejected()
true if message status is REJECTED |
void |
setRecipient(java.lang.String recipient)
Phone number where the message will be or was sent. |
void |
setStatus(int status)
Possible status are PENDING , ACCEPTED , REJECTED ,
GATEWAY_ERROR and DOUBTFUL . |
void |
setStatus(int status,
java.lang.String text)
Sets status and provides descriptive text (e.g. reason for rejection). |
void |
setText(java.lang.String text)
The message's text (content). |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int PENDING
public static final int ACCEPTED
public static final int REJECTED
public static final int GATEWAY_ERROR
public static final int DOUBTFUL
Constructor Detail |
public SmsMessage()
public SmsMessage(java.lang.String recipient, java.lang.String text)
recipient
- see setRecipient
text
- see setText
Method Detail |
public void setRecipient(java.lang.String recipient)
getRecipient()
public java.lang.String getRecipient()
setRecipient(java.lang.String)
public void setText(java.lang.String text)
getText()
public java.lang.String getText()
setText
public boolean isPending()
PENDING
setStatus
public boolean isAccepted()
ACCEPTED
setStatus
public boolean isRejected()
REJECTED
setStatus
public boolean isGatewayError()
GATEWAY_ERROR
setStatus
public boolean isDoubtful()
DOUBTFUL
setStatus
public java.lang.String getStatusText()
setStatus(int status, String text)
public void setStatus(int status)
PENDING
, ACCEPTED
, REJECTED
,
GATEWAY_ERROR
and DOUBTFUL
.
isPending()
,
isAccepted()
,
isRejected()
,
isGatewayError()
,
isDoubtful()
public void setStatus(int status, java.lang.String text)
setStatus(int status)
,
getStatusText()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |