Newer
Older
task-bldg / src / main / java / osm / surveyor / task / util / JsonProperties.java
@haya4 haya4 on 27 Jul 2022 1 KB fix : Geojson.parse()
  1. package osm.surveyor.task.util;
  2.  
  3. import java.util.Hashtable;
  4.  
  5. import com.fasterxml.jackson.databind.JsonNode;
  6.  
  7. import lombok.Getter;
  8. import lombok.Setter;
  9.  
  10. @Getter
  11. @Setter
  12. public class JsonProperties extends JsonTemple {
  13. /*
  14. * "properties":{
  15. * "id":"64412288"
  16. * }
  17. */
  18. private String name;
  19. private String path;
  20. private String id;
  21. private String version;
  22. private Long prefcode;
  23. private String prefname;
  24. private Long citycode;
  25. private String cityname;
  26. private Long meshcode;
  27. public Hashtable<String,Object> items = new Hashtable<>();
  28. public String toString() {
  29. StringBuffer sb = new StringBuffer();
  30. boolean c1 = false;
  31. sb.append("{");
  32. c1 = outStr(c1, sb, "name", this.name);
  33. c1 = outStr(c1, sb, "path", this.path);
  34. c1 = outStr(c1, sb, "id", this.id);
  35. c1 = outStr(c1, sb, "version", this.version);
  36. c1 = out(c1, sb, "prefcode", getPrefcode());
  37. c1 = outStr(c1, sb, "prefname", getPrefname());
  38. sb.append("}");
  39. return sb.toString();
  40. }
  41. public void parse(JsonNode node) {
  42. JsonNode node1 = node.get("name");
  43. if (node1 != null) {
  44. this.name = node1.textValue();
  45. }
  46. node1 = node.get("path");
  47. if (node1 != null) {
  48. this.path = node1.textValue();
  49. }
  50. node1 = node.get("id");
  51. if (node1 != null) {
  52. this.id = node1.textValue();
  53. }
  54.  
  55. node1 = node.get("version");
  56. if (node1 != null) {
  57. this.version = node1.textValue();
  58. }
  59.  
  60. node1 = node.get("prefcode");
  61. if (node1 != null) {
  62. setPrefcode(node1.longValue());
  63. }
  64.  
  65. node1 = node.get("prefname");
  66. if (node1 != null) {
  67. setPrefname(node1.textValue());
  68. }
  69. }
  70. }