source: josm/trunk/src/org/openstreetmap/josm/data/osm/Tagged.java@ 13414

Last change on this file since 13414 was 13414, checked in by Don-vip, 6 years ago

fix #15452 - More details are needed for "Tag value longer than allowed" (patch by Klumbumbus, modified)

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.util.Collection;
5import java.util.Map;
6
7/**
8 * Objects implement Tagged if they provide a map of key/value pairs.
9 *
10 * @since 2115
11 */
12// FIXME: better naming? setTags(), getTags(), getKeys() instead of keySet() ?
13//
14public interface Tagged {
15
16 /**
17 * The maximum tag length allowed by OSM API
18 * @since 13414
19 */
20 int MAX_TAG_LENGTH = 255;
21
22 /**
23 * Sets the map of key/value pairs
24 *
25 * @param keys the map of key value pairs. If null, reset to the empty map.
26 */
27 void setKeys(Map<String, String> keys);
28
29 /**
30 * Replies the map of key/value pairs. Never null, but may be the empty map.
31 *
32 * @return the map of key/value pairs
33 */
34 Map<String, String> getKeys();
35
36 /**
37 * Sets a key/value pairs
38 *
39 * @param key the key
40 * @param value the value. If null, removes the key/value pair.
41 */
42 void put(String key, String value);
43
44 /**
45 * Sets a key/value pairs
46 *
47 * @param tag The tag to set.
48 * @since 10736
49 */
50 default void put(Tag tag) {
51 put(tag.getKey(), tag.getValue());
52 }
53
54 /**
55 * Replies the value of the given key; null, if there is no value for this key
56 *
57 * @param key the key
58 * @return the value
59 */
60 String get(String key);
61
62 /**
63 * Removes a given key/value pair
64 *
65 * @param key the key
66 */
67 void remove(String key);
68
69 /**
70 * Replies true, if there is at least one key/value pair; false, otherwise
71 *
72 * @return true, if there is at least one key/value pair; false, otherwise
73 */
74 boolean hasKeys();
75
76 /**
77 * Replies true if there is a tag with key <code>key</code>.
78 *
79 * @param key the key
80 * @return true, if there is a tag with key <code>key</code>
81 * @since 11608
82 */
83 default boolean hasKey(String key) {
84 return get(key) != null;
85 }
86
87 /**
88 * Replies the set of keys
89 *
90 * @return the set of keys
91 */
92 Collection<String> keySet();
93
94 /**
95 * Removes all tags
96 */
97 void removeAll();
98}
Note: See TracBrowser for help on using the repository browser.