PageRenderTime 27ms CodeModel.GetById 21ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/association/AssocIndReason.java

http://mobicents.googlecode.com/
Java | 136 lines | 63 code | 20 blank | 53 comment | 2 complexity | 7dd7ec6d1201efa78f460b5febab5dc7 MD5 | raw file
  1package javax.megaco.association;
  2
  3import java.io.Serializable;
  4
  5/**
  6 * Constants used in package javax.megaco.association. This forms the class for
  7 * the association state change indication reason. The reasons indicate why the
  8 * association has undergone the state change.
  9 */
 10public class AssocIndReason implements Serializable {
 11
 12	/**
 13	 * Identifies association state change indication reason to be indication
 14	 * received from peer. Its value shall be set to 1.
 15	 */
 16	public static final int M_IND_RCVD_FRM_PEER = 1;
 17	/**
 18	 * Identifies association state change indication reason to be
 19	 * retransmissions expiry. Its value shall be set to 2.
 20	 */
 21	public static final int M_RETRIES_XPIRED = 2;
 22	/**
 23	 * Identifies association state change indication reason to be timer expiry.
 24	 * Its value shall be set to 3.
 25	 */
 26	public static final int M_TIMER_EXP_IND = 3;
 27	/**
 28	 * Identifies association state change indication reason to be operation
 29	 * completion. Its value shall be set to 4.
 30	 */
 31	public static final int M_OPER_COMPL_IND = 4;
 32	/**
 33	 * Identifies association state change indication reason to be network
 34	 * failure. Its value shall be set to 5.
 35	 */
 36	public static final int M_NW_FAILURE_IND = 5;
 37	/**
 38	 * Identifies association state change indication reason to be network
 39	 * linkup. Its value shall be set to 6.
 40	 */
 41	public static final int M_NW_LINKUP_IND = 6;
 42
 43	/**
 44	 * Identifies a AssocIndReason object that constructs the class with the
 45	 * constant M_IND_RCVD_FRM_PEER.
 46	 */
 47	public static final AssocIndReason IND_RCVD_FRM_PEER = new AssocIndReason(M_IND_RCVD_FRM_PEER);
 48	/**
 49	 * Identifies a AssocIndReason object that constructs the class with the
 50	 * field constant M_RETRIES_XPIRED.
 51	 */
 52	public static final AssocIndReason RETRIES_XPIRED = new AssocIndReason(M_RETRIES_XPIRED);
 53	/**
 54	 * Identifies a AssocIndReason object that constructs the class with the
 55	 * field constant M_TIMER_EXP_IND.
 56	 */
 57	public static final AssocIndReason TIMER_EXP_IND = new AssocIndReason(M_TIMER_EXP_IND);
 58	/**
 59	 * Identifies a AssocIndReason object that constructs the class with the
 60	 * field constant M_OPER_COMPL_IND.
 61	 */
 62	public static final AssocIndReason OPER_COMPL_IND = new AssocIndReason(M_OPER_COMPL_IND);
 63	/**
 64	 * Identifies a AssocIndReason object that constructs the class with the
 65	 * field constant M_NW_FAILURE_IND.
 66	 */
 67	public static final AssocIndReason NW_FAILURE_IND = new AssocIndReason(M_NW_FAILURE_IND);
 68	/**
 69	 * Identifies a AssocIndReason object that constructs the class with the
 70	 * field constant M_NW_LINKUP_IND.
 71	 */
 72	public static final AssocIndReason NW_LINKUP_IND = new AssocIndReason(M_NW_LINKUP_IND);
 73
 74	private int nwLinkupInd = -1;
 75
 76	private AssocIndReason(int nwLinkupInd) {
 77		this.nwLinkupInd = nwLinkupInd;
 78	}
 79
 80	public int getAssocIndReason() {
 81		return nwLinkupInd;
 82	}
 83
 84	public static final AssocIndReason getObject(int value) throws IllegalArgumentException {
 85
 86		switch (value) {
 87
 88		case M_IND_RCVD_FRM_PEER:
 89			return IND_RCVD_FRM_PEER;
 90		case M_RETRIES_XPIRED:
 91			return RETRIES_XPIRED;
 92		case M_TIMER_EXP_IND:
 93			return TIMER_EXP_IND;
 94		case M_OPER_COMPL_IND:
 95			return OPER_COMPL_IND;
 96		case M_NW_FAILURE_IND:
 97			return NW_FAILURE_IND;
 98		case M_NW_LINKUP_IND:
 99			return NW_LINKUP_IND;
100
101		default:
102			throw new IllegalArgumentException("Wrogn value passed, there is no AssocIndReason with code: " + value);
103		}
104	}
105
106	private Object readResolve() {
107		return this.getObject(this.nwLinkupInd);
108	}
109
110	@Override
111	public String toString() {
112		switch (this.nwLinkupInd) {
113
114		case M_IND_RCVD_FRM_PEER:
115			return "AssocIndReason[IND_RCVD_FRM_PEER]";
116		case M_RETRIES_XPIRED:
117			return "AssocIndReason[RETRIES_XPIRED]";
118
119		case M_TIMER_EXP_IND:
120			return "AssocIndReason[TIMER_EXP_IND]";
121
122		case M_OPER_COMPL_IND:
123			return "AssocIndReason[OPER_COMPL_IND]";
124
125		case M_NW_FAILURE_IND:
126			return "AssocIndReason[NW_FAILURE_IND]";
127
128		case M_NW_LINKUP_IND:
129			return "AssocIndReason[NW_LINKUP_IND]";
130
131		default:
132			return "AssocIndReason[" + this.nwLinkupInd + "]";
133		}
134	}
135
136}