PageRenderTime 20ms CodeModel.GetById 14ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 149 lines | 37 code | 24 blank | 88 comment | 2 complexity | 34bcd2bd0230d56db23cbb74327ee21d MD5 | raw file
  1package javax.megaco.message.descriptor;
  2
  3import java.io.Serializable;
  4
  5
  6import javax.megaco.message.Descriptor;
  7import javax.megaco.message.DescriptorType;
  8
  9/**
 10 * The class extends JAIN MEGACO Descriptor. This class describes the DigitMap
 11 * descriptor.
 12 */
 13public class DigitMapDescriptor extends Descriptor implements Serializable {
 14
 15	private String digitMapName = null;
 16	private DigitMapValue digitMapValue = null;
 17	private String digitMapStr = null;
 18
 19	/**
 20	 * Constructs a DigitMap Descriptor.
 21	 */
 22	public DigitMapDescriptor() {
 23		super();
 24		super.descriptorId = DescriptorType.M_DIGIT_MAP_DESC;
 25	}
 26
 27	/**
 28	 * This method cannot be overridden by the derived class. This method
 29	 * returns that the descriptor identifier is of type descriptor DigitMap.
 30	 * This method overrides the corresponding method of the base class
 31	 * Descriptor.
 32	 * 
 33	 * @return Returns an integer value that identifies this DigitMap object as
 34	 *         the type of DigitMap descriptor. It returns the value
 35	 *         M_DIGIT_MAP_DESC for a DigitMap Descriptor.
 36	 */
 37	public final int getDescriptorId() {
 38
 39		return super.descriptorId;
 40	}
 41
 42	/**
 43	 * This method returns the digit map name if set for the digit map
 44	 * descriptor.
 45	 * 
 46	 * @return Returns a string value that identifies the digit map name for the
 47	 *         DigitMap descriptor. If the digit map name is not set, then this
 48	 *         shall return a null value.
 49	 */
 50	public final java.lang.String getDigitMapName() {
 51		return this.digitMapName;
 52	}
 53
 54	/**
 55	 * This method sets the digit map name if set for the digit map descriptor.
 56	 * 
 57	 * @param digitName
 58	 *            - Sets a string value that identifies the digit map name for
 59	 *            the DigitMap descriptor. If the digit map name is not set,
 60	 *            then this shall return a null value.
 61	 * @throws IllegalArgumentException
 62	 *             - Thrown if the string value does not satisfy the grammar for
 63	 *             the digit map name.
 64	 */
 65	public final void setDigitMapName(java.lang.String digitName) throws IllegalArgumentException {
 66
 67		// FIXME: add grammar check
 68		// if(getDigitMapValue() != null)
 69		// {
 70		// throw new
 71		// IllegalArgumentException("Digit map value must not be present when name is set.");
 72		// }
 73		this.digitMapName = digitName;
 74
 75	}
 76
 77	/**
 78	 * This method gets the DigitMap Value. The DigitMap value class contains
 79	 * information about the dial plan. This may also contains special symbols
 80	 * like wildcards and timer values to be used on application of the dial
 81	 * plan.
 82	 * 
 83	 * @returnReturns a DigitMapValue object.
 84	 */
 85	public final DigitMapValue getDigitMapValue() {
 86		return this.digitMapValue;
 87	}
 88
 89	/**
 90	 * This method sets the DigitMap Value.
 91	 * 
 92	 * @param digitValue
 93	 *            - The DigitMap value object refernce.
 94	 * @throws IllegalArgumentException
 95	 *             - Thrown if the digit map value passed in the arguments
 96	 *             contains invalid parameters.
 97	 */
 98	public final void setDigitMapValue(DigitMapValue digitValue) throws IllegalArgumentException {
 99
100		// if(getDigitMapName() != null)
101		// {
102		// throw new
103		// IllegalArgumentException("Digit map name must not be present when value is set.");
104		// }
105		// FIXME: add checks
106
107		this.digitMapValue = digitValue;
108
109	}
110
111	/**
112	 * This method gets the DigitMap Value in the string format. The DigitMap
113	 * value class contains information about the dial plan. This may also
114	 * contains special symbols like wildcards and timer values to be used on
115	 * application of the dial plan.
116	 * 
117	 * @return Returns a DigitMapValue java.lang.String object.
118	 */
119	public final java.lang.String getDigitMapValueStr() {
120		return this.digitMapStr;
121
122	}
123
124	/**
125	 * This method sets the DigitMap Value in the string format. The
126	 * applications may use this method in case it has pre-encoded dial plan and
127	 * wants to use the same for subsequent calls. The digitValueStr string set
128	 * in this method must be in the same format as defined by the MEGACO
129	 * protocol.
130	 * 
131	 * @param digitValue
132	 *            - The DigitMap value object refernce.
133	 * @throws IllegalArgumentException
134	 *             - Thrown if the digit map value passed in the arguments
135	 *             contains invalid parameters.
136	 */
137	public final void setDigitMapValueStr(java.lang.String digitValueStr) throws IllegalArgumentException {
138
139		if (getDigitMapName() != null) {
140			throw new IllegalArgumentException("Digit map name must not be present when digit map string is set.");
141		}
142		// FIXME: add checks:
143		// FIXME - shouldnt it be DigitMapString ?
144
145		this.digitMapStr = digitValueStr;
146
147	}
148
149}