Fields Summary |
---|
public static Class | clazzClass handle. |
public static final String | NAMESubscriptionState header field label. |
public static final String | STATE_ACTIVE'active' state label. |
public static final String | STATE_PENDING'pending' state label. |
public static final String | STATE_TERMINATED'terminated' state label. |
public static final String | PARAM_REASON'reason' parameter label. |
public static final String | PARAM_EXPIRES'expires' parameter label. |
public static final String | PARAM_RETRY_AFTER'retry-after' parameter label. |
private String | stateCurrent subscription state. |
Methods Summary |
---|
public java.lang.String | encodeBody()Encode this into a cannonical String.
if (state == null) {
return "";
}
return state + encodeWithSep();
|
public java.lang.String | getExpires()Returns the subscription expiration time in seconds.
return getParameter(PARAM_EXPIRES);
|
public java.lang.String | getState()Returns the current subscription state.
return state;
|
public java.lang.Object | getValue()Returns the value of the current object, i.e., the subscription state.
return state;
|
public boolean | isActive()Checks if the current subscription state is "active".
if (state == null) {
return false;
}
return state.equalsIgnoreCase(STATE_ACTIVE);
|
public boolean | isTerminated()Checks if the current subscription state is "terminated".
if (state == null) {
return false;
}
return state.equalsIgnoreCase(STATE_TERMINATED);
|
public void | setExpires(java.lang.String expires)Sets the subscription expiration time in seconds.
int intExpires;
try {
intExpires = Integer.parseInt(expires);
} catch (NumberFormatException e) {
intExpires = -1;
}
if (intExpires < 0) {
throw new IllegalArgumentException("Invalid 'expires': " + expires);
}
setParameter(PARAM_EXPIRES, expires);
|
public void | setExpires(int expires)Sets the subscription expiration time in seconds.
if (expires < 0) {
throw new IllegalArgumentException("Invalid 'expires': " + expires);
}
setParameter(PARAM_EXPIRES, new Integer(expires).toString());
|
public void | setState(java.lang.String newState)Sets the subscription state.
if (newState == null || newState.equals("")) {
throw new IllegalArgumentException("Invalid state value: " +
newState);
}
state = newState.trim();
|