Package org.openstreetmap.josm.data.osm
Interface Tagged
- All Known Subinterfaces:
INode,IPrimitive,IRelation<M>,IWay<N>
- All Known Implementing Classes:
AbstractPrimitive,Changeset,HistoryNode,HistoryOsmPrimitive,HistoryRelation,HistoryWay,Node,NodeData,OsmPrimitive,PrimitiveData,Relation,RelationData,Tag,VectorNode,VectorPrimitive,VectorRelation,VectorWay,Way,WayData
public interface Tagged
Objects implement Tagged if they provide a map of key/value pairs.
- Since:
- 2115
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe maximum tag length allowed by OSM API -
Method Summary
Modifier and TypeMethodDescriptionReplies the value of the given key; null, if there is no value for this keygetKeys()Replies the map of key/value pairs.intGets the number of keysdefault booleanReplies true if there is a tag with keykey.booleanhasKeys()Replies true, if there is at least one key/value pair; false, otherwisedefault booleanReplies true if there is a non-empty tag with keykey.default booleanTests whether this primitive contains a tag consisting ofkeyandvalue.default booleanTests whether this primitive contains a tag consisting ofkeyand any ofvalues.default booleanhasTag(String key, Collection<String> values) Tests whether this primitive contains a tag consisting ofkeyand any ofvalues.default booleanhasTagDifferent(String key, String value) Tests whether this primitive contains a tag consisting ofkeyand a value different fromvalue.default booleanhasTagDifferent(String key, String... values) Tests whether this primitive contains a tag consisting ofkeyand none ofvalues.default booleanhasTagDifferent(String key, Collection<String> values) Tests whether this primitive contains a tag consisting ofkeyand none ofvalues.default booleanisKeyFalse(String key) Returns true if thekeycorresponds to an OSM false value.default booleanReturns true if thekeycorresponds to an OSM true value.keys()Replies the keys as streamkeySet()Replies the set of keysstatic TaggedReturns a Tagged instance for the given tag mapstatic TaggedofTags(Collection<Tag> tags) Returns a Tagged instance for the given tag collectionvoidSets a key/value pairsdefault voidSets a key/value pairsdefault voidAdd all key/value pairs.voidRemoves a given key/value pairvoidRemoves all tagsvoidSets the map of key/value pairsdefault voidvisitKeys(KeyValueVisitor visitor) Calls the visitor for every key/value pair.
-
Field Details
-
MAX_TAG_LENGTH
The maximum tag length allowed by OSM API- Since:
- 13414
- See Also:
-
-
Method Details
-
setKeys
Sets the map of key/value pairs- Parameters:
keys- the map of key value pairs. If null, reset to the empty map.
-
getKeys
Replies the map of key/value pairs. Never null, but may be the empty map.- Returns:
- the map of key/value pairs
-
visitKeys
Calls the visitor for every key/value pair.- Parameters:
visitor- The visitor to call.- Since:
- 13668
- See Also:
-
put
Sets a key/value pairs- Parameters:
key- the keyvalue- the value. If null, removes the key/value pair.
-
put
Sets a key/value pairs- Parameters:
tag- The tag to set.- Since:
- 10736
-
putAll
Add all key/value pairs. This may be more performant thanput(java.lang.String, java.lang.String), depending upon the implementation. By default, this callsput(java.lang.String, java.lang.String)for each map entry.- Parameters:
tags- The tag map to add- Since:
- 18473
-
get
Replies the value of the given key; null, if there is no value for this key- Parameters:
key- the key- Returns:
- the value
-
remove
Removes a given key/value pair- Parameters:
key- the key
-
hasKeys
boolean hasKeys()Replies true, if there is at least one key/value pair; false, otherwise- Returns:
- true, if there is at least one key/value pair; false, otherwise
-
hasKey
Replies true if there is a tag with keykey. The value could however be empty. SeehasTag(String)to check for non-empty tags.- Parameters:
key- the key- Returns:
- true, if there is a tag with key
key - Since:
- 11608
- See Also:
-
hasTag
Replies true if there is a non-empty tag with keykey.- Parameters:
key- the key- Returns:
- true, if there is a non-empty tag with key
key - Since:
- 13430
- See Also:
-
hasTag
Tests whether this primitive contains a tag consisting ofkeyandvalue.- Parameters:
key- the key forming the tag.value- value forming the tag.- Returns:
- true if primitive contains a tag consisting of
keyandvalue. - Since:
- 13668
-
hasTag
Tests whether this primitive contains a tag consisting ofkeyand any ofvalues.- Parameters:
key- the key forming the tag.values- one or many values forming the tag.- Returns:
- true if primitive contains a tag consisting of
keyand any ofvalues. - Since:
- 13668
-
hasTag
Tests whether this primitive contains a tag consisting ofkeyand any ofvalues.- Parameters:
key- the key forming the tag.values- one or many values forming the tag.- Returns:
- true if primitive contains a tag consisting of
keyand any ofvalues. - Since:
- 13668
-
hasTagDifferent
Tests whether this primitive contains a tag consisting ofkeyand a value different fromvalue.- Parameters:
key- the key forming the tag.value- value not forming the tag.- Returns:
- true if primitive contains a tag consisting of
keyand a value different fromvalue. - Since:
- 13668
-
hasTagDifferent
Tests whether this primitive contains a tag consisting ofkeyand none ofvalues.- Parameters:
key- the key forming the tag.values- one or many values forming the tag.- Returns:
- true if primitive contains a tag consisting of
keyand none ofvalues. - Since:
- 13668
-
hasTagDifferent
Tests whether this primitive contains a tag consisting ofkeyand none ofvalues.- Parameters:
key- the key forming the tag.values- one or many values forming the tag.- Returns:
- true if primitive contains a tag consisting of
keyand none ofvalues. - Since:
- 13668
-
keySet
Replies the set of keys- Returns:
- the set of keys
- See Also:
-
keys
Replies the keys as stream- Returns:
- the keys as stream
- Since:
- 17584
- See Also:
-
getNumKeys
int getNumKeys()Gets the number of keys- Returns:
- The number of keys set for this tagged object.
- Since:
- 13625
-
removeAll
void removeAll()Removes all tags -
isKeyTrue
Returns true if thekeycorresponds to an OSM true value.- Parameters:
key- OSM key- Returns:
trueif thekeycorresponds to an OSM true value- See Also:
-
isKeyFalse
Returns true if thekeycorresponds to an OSM false value.- Parameters:
key- OSM key- Returns:
trueif thekeycorresponds to an OSM false value- See Also:
-
ofTags
Returns a Tagged instance for the given tag collection- Parameters:
tags- the tag collection- Returns:
- a Tagged instance for the given tag collection
-
ofMap
Returns a Tagged instance for the given tag map- Parameters:
tags- the tag map- Returns:
- a Tagged instance for the given tag map
-