PageRenderTime 40ms CodeModel.GetById 29ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 144 lines | 45 code | 19 blank | 80 comment | 8 complexity | 875a4f4f3a9cf5cf7ac425777d7b1f3b MD5 | raw file
  1package javax.megaco.message.descriptor;
  2
  3import java.io.Serializable;
  4
  5
  6import javax.megaco.pkg.ParamRelation;
  7import javax.megaco.pkg.ParamValueType;
  8
  9/**
 10 * The MEGACO Modem Parameter value class stores the parameter name and value
 11 * for the Modem Descriptor.
 12 */
 13public class ModemParamValue implements Serializable {
 14
 15	private ParamRelation paramRelation;
 16	private String paramName;
 17	private java.lang.String[] paramsValue;
 18
 19	/**
 20	 * Constructs a Jain Megaco Modem Parameter Value class that is used for
 21	 * specifying the parameters of a modem descriptor.
 22	 */
 23	public ModemParamValue() {
 24
 25	}
 26
 27	/**
 28	 * The method can be used to get the parameter name for the modem descriptor
 29	 * parameter.
 30	 * 
 31	 * @return paramName - The string value corresponding to the parameter name.
 32	 *         If the param name is not set then this method will return NULL.
 33	 */
 34	public java.lang.String getParamName() {
 35
 36		return this.paramName;
 37	}
 38
 39	/**
 40	 * The method can be used to set the parameter name for the modem descriptor
 41	 * parameter.
 42	 * 
 43	 * @param name
 44	 *            - The string value corresponding to the parameter name.
 45	 * @throws IllegalArgumentException
 46	 *             - Exception shall be thrown if the param name is not of
 47	 *             proper format.
 48	 */
 49	public void setParamName(java.lang.String name) throws IllegalArgumentException {
 50		if (name == null) {
 51			throw new IllegalArgumentException("ParamName must not be null");
 52		}
 53
 54		DescriptorUtils.checkParamNameRules(name);
 55
 56		this.paramName = name;
 57	}
 58
 59	/**
 60	 * The method can be used to get the relation set in the parameter for the
 61	 * parameter value as defined in the MEGACO packages. The relation operator
 62	 * can be one of equal, not equal, greater than or less than operator for
 63	 * single value. The Megaco parameter is accompanied by a parameter value
 64	 * that can be single value or set of values or sublist of values or range
 65	 * of values. The relation operator can be equal when the value is set or
 66	 * sublist or range. This method specifies both the relation operator and
 67	 * also specifies whether the accompaning parameter value is single value or
 68	 * set of values or sublist of values or range of value. If the relation
 69	 * specifies set or range or sublist, it automatically assumes the relation
 70	 * to be "MEGACO_EQUAL".
 71	 * 
 72	 * @return paramRelation - The integer corresponding to the parameter
 73	 *         relation. The values shall be defined in ParamRelation. If the
 74	 *         param value is not set then this method will return NULL.
 75	 */
 76	public ParamRelation getParamsValueRelation() {
 77		return this.paramRelation;
 78	}
 79
 80	/**
 81	 * The method can be used to get the valid parameter which is of string
 82	 * type.
 83	 * 
 84	 * @return value - The string values that needs to be set for the parameter.
 85	 *         If the param value is not set then this method will return NULL.
 86	 */
 87	public java.lang.String[] getParamsValue() {
 88		return this.paramsValue;
 89	}
 90
 91	/**
 92	 * The method can be used to set the relation of the value as defined in the
 93	 * MEGACO packages. The relation operator can be one of equal, not equal,
 94	 * greater than or less than operator for single value. The Megaco parameter
 95	 * is accompanied by a parameter value that can be single value or set of
 96	 * values or sublist of values or range of values. The relation operator can
 97	 * be equal when the value is set or sublist or range. This method specifies
 98	 * both the relation operator and also specifies whether the accompaning
 99	 * parameter value is single value or set of values or sublist of values or
100	 * range of value. If the relation specifies set or range or sublist, it
101	 * automatically assumes the relation to be "MEGACO_EQUAL". The default
102	 * value of the relation can be set in constructor of each class that
103	 * derives this class.
104	 * 
105	 * @param paramRelation
106	 *            paramRelation - The integer corresponding to the value
107	 *            relation. The values shall be defined in ParamRelation.
108	 * @throws IllegalArgumentException
109	 *             : This exception is raised if the reference of Param Relation
110	 *             passed to this method is NULL.
111	 */
112	public void setParamsValueRelation(ParamRelation paramRelation) throws IllegalArgumentException {
113		if (paramRelation == null) {
114			throw new IllegalArgumentException("ParamRelation must not be null.");
115		}
116
117		this.paramRelation = paramRelation;
118	}
119
120	/**
121	 * This method sets the list of parameter values where each element is of
122	 * string type.
123	 * 
124	 * @param value
125	 *            - A vector of string values.
126	 * @throws IllegalArgumentException
127	 *             - Thrown if invalid argument is passed for setting the item
128	 *             value.
129	 */
130	public void setParamsValue(java.lang.String[] value) throws IllegalArgumentException {
131		if (value == null) {
132			throw new IllegalArgumentException("Value must not be null.");
133		}
134		if (value.length == 0) {
135			throw new IllegalArgumentException("Value must not be empty.");
136		}
137		this.paramsValue = value;
138	}
139
140	public java.lang.String toString() {
141		return super.toString();
142	}
143
144}