PageRenderTime 15ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/message/ContextInfo.java

http://mobicents.googlecode.com/
Java | 48 lines | 33 code | 10 blank | 5 comment | 3 complexity | 4afd25548f65445aa0f499398a45543f MD5 | raw file
 1package javax.megaco.message;
 2
 3import java.io.Serializable;
 4
 5
 6
 7/**
 8 * This class defines the context information block that contains the context id
 9 * sent in the protocol and the context level parameters.
10 * 
11 */
12public class ContextInfo implements Serializable {
13	public static final int M_CTX_NULL = 0;
14	public static final int M_CTX_CHOOSE = 0xFFFFFFFE;
15	public static final int M_CTX_ALL = 0xFFFFFFFF;
16
17	private int contextId;
18	private ContextParam contextParam = null;
19
20	public ContextInfo(int contextId)
21			throws IllegalArgumentException {
22		if (contextId < 0) {
23			IllegalArgumentException invalidArgumentException = new IllegalArgumentException(
24					"ContextID for ContextInfo cannot be less than zero");
25			throw invalidArgumentException;
26		}
27		this.contextId = contextId;
28	}
29
30	public int getContextId() {
31		return this.contextId;
32	}
33
34	public ContextParam getContextParam() {
35		return this.contextParam;
36	}
37
38	public void setContextParam(ContextParam contextParam)
39			throws IllegalArgumentException {
40		if (contextParam == null) {
41			IllegalArgumentException IllegalArgumentException = new IllegalArgumentException(
42					"ContextParam cannot be null for ContextInfo");
43			throw IllegalArgumentException;
44		}
45
46		this.contextParam = contextParam;
47	}
48}