Newer
Older
task-bldg / src / main / java / osm / surveyor / task / util / JsonProperties.java
  1. package osm.surveyor.task.util;
  2.  
  3. import com.fasterxml.jackson.databind.JsonNode;
  4.  
  5. import lombok.Getter;
  6. import lombok.Setter;
  7.  
  8. @Getter
  9. @Setter
  10. public class JsonProperties {
  11. /*
  12. * "properties":{
  13. * "id":"64412288"
  14. * }
  15. */
  16. private String name;
  17. private String path;
  18. private String id;
  19. private String version;
  20. public String toString() {
  21. StringBuffer sb = new StringBuffer();
  22. boolean c1 = false;
  23. sb.append("{");
  24. c1 = Geojson.outStr(c1, sb, "name", this.name);
  25. c1 = Geojson.outStr(c1, sb, "path", this.path);
  26. c1 = Geojson.outStr(c1, sb, "id", this.id);
  27. c1 = Geojson.outStr(c1, sb, "version", this.version);
  28. sb.append("}");
  29. return sb.toString();
  30. }
  31. public void parse(JsonNode node) {
  32. JsonNode node1 = node.get("name");
  33. if (node1 != null) {
  34. this.name = node1.textValue();
  35. }
  36. node1 = node.get("path");
  37. if (node1 != null) {
  38. this.path = node1.textValue();
  39. }
  40. node1 = node.get("id");
  41. if (node1 != null) {
  42. this.id = node1.textValue();
  43. }
  44.  
  45. node1 = node.get("version");
  46. if (node1 != null) {
  47. this.version = node1.textValue();
  48. }
  49. }
  50. }