PageRenderTime 41ms CodeModel.GetById 31ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 200 lines | 126 code | 68 blank | 6 comment | 2 complexity | 2e1eae6a783969051d99d11814981880 MD5 | raw file
  1package javax.megaco.association;
  2
  3/**
  4 * Constants used in package javax.megaco.association. This defines the type of
  5 * the association event. It qualifies each association event.
  6 * 
  7 * 
  8 */
  9public final class AssocEventType {
 10
 11	public static final int M_CREATE_ASSOC_REQ = 1;
 12	public static final int M_DELETE_ASSOC_REQ = 2;
 13	public static final int M_MODIFY_ASSOC_REQ = 3;
 14	public static final int M_ASSOC_STATE_IND = 4;
 15	public static final int M_CREATE_ASSOC_RESP = 5;
 16	public static final int M_DELETE_ASSOC_RESP = 6;
 17	public static final int M_MODIFY_ASSOC_RESP = 7;
 18	public static final int M_ASSOC_CONFIG_REQ = 8;
 19	public static final int M_ASSOC_CONFIG_RESP = 9;
 20	public static final int M_DELETE_TXN_REQ = 10;
 21	public static final int M_DELETE_TXN_RESP = 11;
 22	public static final int M_CREATE_TXN_REQ = 12;
 23	public static final int M_CREATE_TXN_RESP = 13;
 24	public static final int M_TXN_ERR_IND = 14;
 25
 26	public static final AssocEventType CREATE_ASSOC_REQ = new AssocEventType(M_CREATE_ASSOC_REQ);
 27
 28	public static final AssocEventType DELETE_ASSOC_REQ = new AssocEventType(M_DELETE_ASSOC_REQ);
 29
 30	public static final AssocEventType MODIFY_ASSOC_REQ = new AssocEventType(M_MODIFY_ASSOC_REQ);
 31
 32	public static final AssocEventType ASSOC_STATE_IND = new AssocEventType(M_ASSOC_STATE_IND);
 33
 34	public static final AssocEventType CREATE_ASSOC_RESP = new AssocEventType(M_CREATE_ASSOC_RESP);
 35
 36	public static final AssocEventType DELETE_ASSOC_RESP = new AssocEventType(M_DELETE_ASSOC_RESP);
 37
 38	public static final AssocEventType MODIFY_ASSOC_RESP = new AssocEventType(M_MODIFY_ASSOC_RESP);
 39
 40	public static final AssocEventType ASSOC_CONFIG_REQ = new AssocEventType(M_ASSOC_CONFIG_REQ);
 41
 42	public static final AssocEventType ASSOC_CONFIG_RESP = new AssocEventType(M_ASSOC_CONFIG_RESP);
 43
 44	public static final AssocEventType DELETE_TXN_REQ = new AssocEventType(M_DELETE_TXN_REQ);
 45
 46	public static final AssocEventType DELETE_TXN_RESP = new AssocEventType(M_DELETE_TXN_RESP);
 47
 48	public static final AssocEventType CREATE_TXN_REQ = new AssocEventType(M_CREATE_TXN_REQ);
 49
 50	public static final AssocEventType CREATE_TXN_RESP = new AssocEventType(M_CREATE_TXN_RESP);
 51
 52	public static final AssocEventType TXN_ERR_IND = new AssocEventType(M_TXN_ERR_IND);
 53
 54	private int event_type;
 55
 56	private AssocEventType(int event_type) {
 57		this.event_type = event_type;
 58	}
 59
 60	public int getAssocEventType() {
 61		return this.event_type;
 62	}
 63
 64	public static final AssocEventType getObject(int value) throws IllegalArgumentException {
 65		AssocEventType a = null;
 66		switch (value) {
 67		case M_CREATE_ASSOC_REQ:
 68			a = CREATE_ASSOC_REQ;
 69			break;
 70
 71		case M_DELETE_ASSOC_REQ:
 72			a = DELETE_ASSOC_REQ;
 73			break;
 74
 75		case M_MODIFY_ASSOC_REQ:
 76			a = MODIFY_ASSOC_REQ;
 77			break;
 78
 79		case M_ASSOC_STATE_IND:
 80			a = ASSOC_STATE_IND;
 81			break;
 82
 83		case M_CREATE_ASSOC_RESP:
 84			a = CREATE_ASSOC_RESP;
 85			break;
 86
 87		case M_DELETE_ASSOC_RESP:
 88			a = DELETE_ASSOC_RESP;
 89			break;
 90
 91		case M_MODIFY_ASSOC_RESP:
 92			a = MODIFY_ASSOC_RESP;
 93			break;
 94
 95		case M_ASSOC_CONFIG_REQ:
 96			a = ASSOC_CONFIG_REQ;
 97			break;
 98
 99		case M_ASSOC_CONFIG_RESP:
100			a = ASSOC_CONFIG_RESP;
101			break;
102
103		case M_DELETE_TXN_REQ:
104			a = DELETE_TXN_REQ;
105			break;
106
107		case M_DELETE_TXN_RESP:
108			a = DELETE_TXN_RESP;
109			break;
110
111		case M_CREATE_TXN_REQ:
112			a = CREATE_TXN_REQ;
113			break;
114
115		case M_CREATE_TXN_RESP:
116			a = CREATE_TXN_RESP;
117			break;
118
119		case M_TXN_ERR_IND:
120			a = TXN_ERR_IND;
121			break;
122
123		default:
124			throw new IllegalArgumentException("There is no AsscoEventType for passed value = " + value);
125
126		}
127		return a;
128	}
129
130	private Object readResolve() {
131		return this.getObject(this.event_type);
132	}
133
134	@Override
135	public String toString() {
136		switch (this.event_type) {
137		case M_CREATE_ASSOC_REQ:
138
139			return "AssocEventType[CREATE_ASSOC_REQ]";
140
141		case M_DELETE_ASSOC_REQ:
142
143			return "AssocEventType[DELETE_ASSOC_REQ]";
144
145		case M_MODIFY_ASSOC_REQ:
146
147			return "AssocEventType[MODIFY_ASSOC_REQ]";
148
149		case M_ASSOC_STATE_IND:
150
151			return "AssocEventType[ASSOC_STATE_IND]";
152
153		case M_CREATE_ASSOC_RESP:
154
155			return "AssocEventType[CREATE_ASSOC_RESP]";
156
157		case M_DELETE_ASSOC_RESP:
158
159			return "AssocEventType[DELETE_ASSOC_RESP]";
160
161		case M_MODIFY_ASSOC_RESP:
162
163			return "AssocEventType[MODIFY_ASSOC_RESP]";
164
165		case M_ASSOC_CONFIG_REQ:
166
167			return "AssocEventType[ASSOC_CONFIG_REQ]";
168
169		case M_ASSOC_CONFIG_RESP:
170
171			return "AssocEventType[ASSOC_CONFIG_RESP]";
172
173		case M_DELETE_TXN_REQ:
174
175			return "AssocEventType[DELETE_TXN_REQ]";
176
177		case M_DELETE_TXN_RESP:
178
179			return "AssocEventType[DELETE_TXN_RESP]";
180
181		case M_CREATE_TXN_REQ:
182
183			return "AssocEventType[CREATE_TXN_REQ]";
184
185		case M_CREATE_TXN_RESP:
186
187			return "AssocEventType[CREATE_TXN_RESP]";
188
189		case M_TXN_ERR_IND:
190
191			return "AssocEventType[TXN_ERR_IND]";
192
193		default:
194
195			return "AssocEventType[" + this.event_type + "]";
196
197		}
198	}
199
200}