CloudbusRouteRItem.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. from alipay.aop.api.domain.CloudbusPredictRItem import CloudbusPredictRItem
  6. from alipay.aop.api.domain.CloudbusPredictRItem import CloudbusPredictRItem
  7. class CloudbusRouteRItem(object):
  8. def __init__(self):
  9. self._after = None
  10. self._before = None
  11. self._direction = None
  12. self._line_id = None
  13. self._line_name = None
  14. @property
  15. def after(self):
  16. return self._after
  17. @after.setter
  18. def after(self, value):
  19. if isinstance(value, CloudbusPredictRItem):
  20. self._after = value
  21. else:
  22. self._after = CloudbusPredictRItem.from_alipay_dict(value)
  23. @property
  24. def before(self):
  25. return self._before
  26. @before.setter
  27. def before(self, value):
  28. if isinstance(value, CloudbusPredictRItem):
  29. self._before = value
  30. else:
  31. self._before = CloudbusPredictRItem.from_alipay_dict(value)
  32. @property
  33. def direction(self):
  34. return self._direction
  35. @direction.setter
  36. def direction(self, value):
  37. self._direction = value
  38. @property
  39. def line_id(self):
  40. return self._line_id
  41. @line_id.setter
  42. def line_id(self, value):
  43. self._line_id = value
  44. @property
  45. def line_name(self):
  46. return self._line_name
  47. @line_name.setter
  48. def line_name(self, value):
  49. self._line_name = value
  50. def to_alipay_dict(self):
  51. params = dict()
  52. if self.after:
  53. if hasattr(self.after, 'to_alipay_dict'):
  54. params['after'] = self.after.to_alipay_dict()
  55. else:
  56. params['after'] = self.after
  57. if self.before:
  58. if hasattr(self.before, 'to_alipay_dict'):
  59. params['before'] = self.before.to_alipay_dict()
  60. else:
  61. params['before'] = self.before
  62. if self.direction:
  63. if hasattr(self.direction, 'to_alipay_dict'):
  64. params['direction'] = self.direction.to_alipay_dict()
  65. else:
  66. params['direction'] = self.direction
  67. if self.line_id:
  68. if hasattr(self.line_id, 'to_alipay_dict'):
  69. params['line_id'] = self.line_id.to_alipay_dict()
  70. else:
  71. params['line_id'] = self.line_id
  72. if self.line_name:
  73. if hasattr(self.line_name, 'to_alipay_dict'):
  74. params['line_name'] = self.line_name.to_alipay_dict()
  75. else:
  76. params['line_name'] = self.line_name
  77. return params
  78. @staticmethod
  79. def from_alipay_dict(d):
  80. if not d:
  81. return None
  82. o = CloudbusRouteRItem()
  83. if 'after' in d:
  84. o.after = d['after']
  85. if 'before' in d:
  86. o.before = d['before']
  87. if 'direction' in d:
  88. o.direction = d['direction']
  89. if 'line_id' in d:
  90. o.line_id = d['line_id']
  91. if 'line_name' in d:
  92. o.line_name = d['line_name']
  93. return o