/protocols/jain-megaco/megaco-api/src/main/java/javax/megaco/association/AssocIndReason.java

http://mobicents.googlecode.com/ · Java · 136 lines · 63 code · 20 blank · 53 comment · 2 complexity · 7dd7ec6d1201efa78f460b5febab5dc7 MD5 · raw file

  1. package javax.megaco.association;
  2. import java.io.Serializable;
  3. /**
  4. * Constants used in package javax.megaco.association. This forms the class for
  5. * the association state change indication reason. The reasons indicate why the
  6. * association has undergone the state change.
  7. */
  8. public class AssocIndReason implements Serializable {
  9. /**
  10. * Identifies association state change indication reason to be indication
  11. * received from peer. Its value shall be set to 1.
  12. */
  13. public static final int M_IND_RCVD_FRM_PEER = 1;
  14. /**
  15. * Identifies association state change indication reason to be
  16. * retransmissions expiry. Its value shall be set to 2.
  17. */
  18. public static final int M_RETRIES_XPIRED = 2;
  19. /**
  20. * Identifies association state change indication reason to be timer expiry.
  21. * Its value shall be set to 3.
  22. */
  23. public static final int M_TIMER_EXP_IND = 3;
  24. /**
  25. * Identifies association state change indication reason to be operation
  26. * completion. Its value shall be set to 4.
  27. */
  28. public static final int M_OPER_COMPL_IND = 4;
  29. /**
  30. * Identifies association state change indication reason to be network
  31. * failure. Its value shall be set to 5.
  32. */
  33. public static final int M_NW_FAILURE_IND = 5;
  34. /**
  35. * Identifies association state change indication reason to be network
  36. * linkup. Its value shall be set to 6.
  37. */
  38. public static final int M_NW_LINKUP_IND = 6;
  39. /**
  40. * Identifies a AssocIndReason object that constructs the class with the
  41. * constant M_IND_RCVD_FRM_PEER.
  42. */
  43. public static final AssocIndReason IND_RCVD_FRM_PEER = new AssocIndReason(M_IND_RCVD_FRM_PEER);
  44. /**
  45. * Identifies a AssocIndReason object that constructs the class with the
  46. * field constant M_RETRIES_XPIRED.
  47. */
  48. public static final AssocIndReason RETRIES_XPIRED = new AssocIndReason(M_RETRIES_XPIRED);
  49. /**
  50. * Identifies a AssocIndReason object that constructs the class with the
  51. * field constant M_TIMER_EXP_IND.
  52. */
  53. public static final AssocIndReason TIMER_EXP_IND = new AssocIndReason(M_TIMER_EXP_IND);
  54. /**
  55. * Identifies a AssocIndReason object that constructs the class with the
  56. * field constant M_OPER_COMPL_IND.
  57. */
  58. public static final AssocIndReason OPER_COMPL_IND = new AssocIndReason(M_OPER_COMPL_IND);
  59. /**
  60. * Identifies a AssocIndReason object that constructs the class with the
  61. * field constant M_NW_FAILURE_IND.
  62. */
  63. public static final AssocIndReason NW_FAILURE_IND = new AssocIndReason(M_NW_FAILURE_IND);
  64. /**
  65. * Identifies a AssocIndReason object that constructs the class with the
  66. * field constant M_NW_LINKUP_IND.
  67. */
  68. public static final AssocIndReason NW_LINKUP_IND = new AssocIndReason(M_NW_LINKUP_IND);
  69. private int nwLinkupInd = -1;
  70. private AssocIndReason(int nwLinkupInd) {
  71. this.nwLinkupInd = nwLinkupInd;
  72. }
  73. public int getAssocIndReason() {
  74. return nwLinkupInd;
  75. }
  76. public static final AssocIndReason getObject(int value) throws IllegalArgumentException {
  77. switch (value) {
  78. case M_IND_RCVD_FRM_PEER:
  79. return IND_RCVD_FRM_PEER;
  80. case M_RETRIES_XPIRED:
  81. return RETRIES_XPIRED;
  82. case M_TIMER_EXP_IND:
  83. return TIMER_EXP_IND;
  84. case M_OPER_COMPL_IND:
  85. return OPER_COMPL_IND;
  86. case M_NW_FAILURE_IND:
  87. return NW_FAILURE_IND;
  88. case M_NW_LINKUP_IND:
  89. return NW_LINKUP_IND;
  90. default:
  91. throw new IllegalArgumentException("Wrogn value passed, there is no AssocIndReason with code: " + value);
  92. }
  93. }
  94. private Object readResolve() {
  95. return this.getObject(this.nwLinkupInd);
  96. }
  97. @Override
  98. public String toString() {
  99. switch (this.nwLinkupInd) {
  100. case M_IND_RCVD_FRM_PEER:
  101. return "AssocIndReason[IND_RCVD_FRM_PEER]";
  102. case M_RETRIES_XPIRED:
  103. return "AssocIndReason[RETRIES_XPIRED]";
  104. case M_TIMER_EXP_IND:
  105. return "AssocIndReason[TIMER_EXP_IND]";
  106. case M_OPER_COMPL_IND:
  107. return "AssocIndReason[OPER_COMPL_IND]";
  108. case M_NW_FAILURE_IND:
  109. return "AssocIndReason[NW_FAILURE_IND]";
  110. case M_NW_LINKUP_IND:
  111. return "AssocIndReason[NW_LINKUP_IND]";
  112. default:
  113. return "AssocIndReason[" + this.nwLinkupInd + "]";
  114. }
  115. }
  116. }