/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

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