Road.py 2.5 KB

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