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

http://mobicents.googlecode.com/ · Java · 111 lines · 39 code · 19 blank · 53 comment · 8 complexity · d439dcdabb9018fbe12f1fa803b5d17c 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. import javax.megaco.pkg.PkgItemStr;
  6. /**
  7. * The class extends JAIN MEGACO Descriptor. This class describes the package
  8. * descriptor.
  9. */
  10. public class PackageDescriptor extends Descriptor implements Serializable {
  11. private PackagesItem[] packagesItems;
  12. private PkgItemStr[] pkgItemStr;
  13. /**
  14. * Constructs a Package Descriptor.
  15. */
  16. public PackageDescriptor() {
  17. super.descriptorId = DescriptorType.M_PACKAGE_DESC;
  18. }
  19. /**
  20. * This method cannot be overridden by the derived class. This method
  21. * returns that the descriptor identifier is of type Package descriptor.
  22. * This method overrides the corresponding method of the base class
  23. * Descriptor.
  24. *
  25. * @return Returns an integer value that identifies this object as the type
  26. * of package descriptor. It returns that it is Package Descriptor
  27. * i.e., M_PACKAGE_DESC.
  28. */
  29. public int getDescriptorId() {
  30. return super.descriptorId;
  31. }
  32. /**
  33. * This method cannot be overridden by the derived class. This method
  34. * returns the packages Item in the package descriptor.
  35. *
  36. * @return Returns vector value that identifies the package Item value. If
  37. * PackagesItem is not set, then this method would return NULL.
  38. */
  39. public final PackagesItem[] getMegacoPkgItems() {
  40. return this.packagesItems;
  41. }
  42. /**
  43. * This method cannot be overridden by the derived class. This method
  44. * returns the vector of the object of the type packages Item.
  45. *
  46. * @param pkgs_item
  47. * - Vector value that identifies the package Item value.
  48. * @throws IllegalArgumentException
  49. * : This exception is raised if the reference of Packages Item
  50. * passed to this method is NULL.
  51. */
  52. public final void setMegacoPkgItems(PackagesItem[] pkgs_item) throws IllegalArgumentException {
  53. if (pkgs_item == null) {
  54. throw new IllegalArgumentException("PackagesItem[] must not be null.");
  55. }
  56. if (pkgs_item.length == 0) {
  57. throw new IllegalArgumentException("PackagesItem[] must not be empty.");
  58. }
  59. this.packagesItems = pkgs_item;
  60. }
  61. /**
  62. * This method cannot be overridden by the derived class. This method
  63. * returns the packages Item in the package descriptor.
  64. *
  65. * @return Returns vector value that identifies the package Item value. If
  66. * PkgItemStr is not set, then this method would return NULL.
  67. */
  68. public final PkgItemStr[] getMegacoPkgItemsStr() {
  69. return this.pkgItemStr;
  70. }
  71. /**
  72. * This method cannot be overridden by the derived class. This method
  73. * returns the vector of the object of the type packages Item. This method
  74. * will be used for the MEGACO packages which are not defined in the
  75. * javax.megaco.pkg package.
  76. *
  77. * @param pkgs_item
  78. * - Vector value that identifies the package Item value.
  79. * @throws IllegalArgumentException
  80. * : This exception is raised if the reference of Package Item
  81. * String passed to this method is NULL.
  82. */
  83. public final void setMegacoPkgItemsStr(PkgItemStr[] pkgs_item) throws IllegalArgumentException {
  84. if (pkgs_item == null) {
  85. throw new IllegalArgumentException("PkgItemStr[] must not be null.");
  86. }
  87. if (pkgs_item.length == 0) {
  88. throw new IllegalArgumentException("PkgItemStr[] must not be empty.");
  89. }
  90. this.pkgItemStr = pkgs_item;
  91. }
  92. }