PageRenderTime 31ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://mobicents.googlecode.com/
Java | 48 lines | 33 code | 10 blank | 5 comment | 3 complexity | 4afd25548f65445aa0f499398a45543f MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  1. package javax.megaco.message;
  2. import java.io.Serializable;
  3. /**
  4. * This class defines the context information block that contains the context id
  5. * sent in the protocol and the context level parameters.
  6. *
  7. */
  8. public class ContextInfo implements Serializable {
  9. public static final int M_CTX_NULL = 0;
  10. public static final int M_CTX_CHOOSE = 0xFFFFFFFE;
  11. public static final int M_CTX_ALL = 0xFFFFFFFF;
  12. private int contextId;
  13. private ContextParam contextParam = null;
  14. public ContextInfo(int contextId)
  15. throws IllegalArgumentException {
  16. if (contextId < 0) {
  17. IllegalArgumentException invalidArgumentException = new IllegalArgumentException(
  18. "ContextID for ContextInfo cannot be less than zero");
  19. throw invalidArgumentException;
  20. }
  21. this.contextId = contextId;
  22. }
  23. public int getContextId() {
  24. return this.contextId;
  25. }
  26. public ContextParam getContextParam() {
  27. return this.contextParam;
  28. }
  29. public void setContextParam(ContextParam contextParam)
  30. throws IllegalArgumentException {
  31. if (contextParam == null) {
  32. IllegalArgumentException IllegalArgumentException = new IllegalArgumentException(
  33. "ContextParam cannot be null for ContextInfo");
  34. throw IllegalArgumentException;
  35. }
  36. this.contextParam = contextParam;
  37. }
  38. }