Changeset 15211 in josm for trunk/src/org/openstreetmap/josm/data/preferences/sources/SourcePrefHelper.java
- Timestamp:
- 2019-07-06T22:15:55+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/sources/SourcePrefHelper.java
r15099 r15211 8 8 import java.util.List; 9 9 import java.util.Map; 10 import java.util.Optional; 10 11 import java.util.Set; 11 12 import java.util.stream.Collectors; … … 44 45 * @return map (key=value) 45 46 */ 46 public abstract Map<String, String> serialize(SourceEntry entry); 47 public Map<String, String> serialize(SourceEntry entry) { 48 Map<String, String> res = new HashMap<>(); 49 res.put("url", entry.url); 50 res.put("title", entry.title == null ? "" : entry.title); 51 return res; 52 } 47 53 48 54 /** … … 51 57 * @return source entry 52 58 */ 53 public abstract SourceEntry deserialize(Map<String, String> entryStr); 59 public SourceEntry deserialize(Map<String, String> entryStr) { 60 return new SourceEntry(type, 61 entryStr.get("url"), 62 entryStr.get("name"), 63 entryStr.get("title"), 64 Optional.ofNullable(entryStr.get("active")).map(Boolean::parseBoolean).orElse(true)); 65 } 54 66 55 67 /**
Note:
See TracChangeset
for help on using the changeset viewer.