/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

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