PageRenderTime 30ms CodeModel.GetById 13ms app.highlight 12ms RepoModel.GetById 1ms app.codeStats 0ms

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