Streetnumber.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import json
  4. from alipay.aop.api.constant.ParamConstants import *
  5. class Streetnumber(object):
  6. def __init__(self):
  7. self._direction = None
  8. self._distance = None
  9. self._location = None
  10. self._number = None
  11. self._street = 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 location(self):
  26. return self._location
  27. @location.setter
  28. def location(self, value):
  29. self._location = value
  30. @property
  31. def number(self):
  32. return self._number
  33. @number.setter
  34. def number(self, value):
  35. self._number = value
  36. @property
  37. def street(self):
  38. return self._street
  39. @street.setter
  40. def street(self, value):
  41. self._street = 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.location:
  55. if hasattr(self.location, 'to_alipay_dict'):
  56. params['location'] = self.location.to_alipay_dict()
  57. else:
  58. params['location'] = self.location
  59. if self.number:
  60. if hasattr(self.number, 'to_alipay_dict'):
  61. params['number'] = self.number.to_alipay_dict()
  62. else:
  63. params['number'] = self.number
  64. if self.street:
  65. if hasattr(self.street, 'to_alipay_dict'):
  66. params['street'] = self.street.to_alipay_dict()
  67. else:
  68. params['street'] = self.street
  69. return params
  70. @staticmethod
  71. def from_alipay_dict(d):
  72. if not d:
  73. return None
  74. o = Streetnumber()
  75. if 'direction' in d:
  76. o.direction = d['direction']
  77. if 'distance' in d:
  78. o.distance = d['distance']
  79. if 'location' in d:
  80. o.location = d['location']
  81. if 'number' in d:
  82. o.number = d['number']
  83. if 'street' in d:
  84. o.street = d['street']
  85. return o