Package org.openstreetmap.josm.data.osm
Class Tag
java.lang.Object
org.openstreetmap.josm.data.osm.Tag
- All Implemented Interfaces:
Serializable,Map.Entry<String,,String> Tagged
Tag represents an immutable key/value-pair. Both the key and the value may be empty, but not null.
It implements the Tagged interface. However, since instances of this class are immutable,
the modifying methods throw an UnsupportedOperationException.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate static final longprivate final StringFields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReplies the value of the given key; null, if there is no value for this keygetKey()Replies the key of the tag.getKeys()Replies the map of key/value pairs.final intGets the number of keysgetValue()Replies the value of the tag.inthashCode()booleanhasKeys()Replies true, if there is at least one key/value pair; false, otherwisebooleantrue if this is a direction dependent tag (e.g.keySet()Replies the set of keysbooleanmatchesKey(String key) Replies true if the key of this tag is equal tokey.static TagThis constructs aTagby splittingson the first equality sign.voidUnsupported.voidUnsupported.voidUnsupported.voidUnsupported.This is not supported by this implementation.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.osm.Tagged
hasKey, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keys, put, putAll, visitKeys
-
Field Details
-
serialVersionUID
- See Also:
-
key
-
value
-
-
Constructor Details
-
Tag
public Tag()Create an empty tag whose key and value are empty. -
Tag
Create a tag whose key iskeyand whose value is empty.- Parameters:
key- the key. If null, it is set to the empty key.
-
Tag
Creates a tag for a key and a value. If key and/or value are null, the empty value "" is assumed.- Parameters:
key- the keyvalue- the value
-
Tag
Creates clone of the tagtag.- Parameters:
tag- the tag.
-
-
Method Details
-
getKey
Replies the key of the tag. This is never null. -
getValue
Replies the value of the tag. This is never null. -
setValue
This is not supported by this implementation.- Specified by:
setValuein interfaceMap.Entry<String,String> - Parameters:
value- ignored- Returns:
- (Does not return)
- Throws:
UnsupportedOperationException- always
-
matchesKey
Replies true if the key of this tag is equal tokey. Ifkeyis null, assumes the empty key.- Parameters:
key- the key- Returns:
- true if the key of this tag is equal to
key
-
hashCode
-
equals
-
ofString
This constructs aTagby splittingson the first equality sign.- Parameters:
s- the string to convert- Returns:
- the constructed tag
- See Also:
-
toString
-
setKeys
Unsupported.- Specified by:
setKeysin interfaceTagged- Parameters:
keys- ignored- Throws:
UnsupportedOperationException- always
-
getKeys
Description copied from interface:TaggedReplies the map of key/value pairs. Never null, but may be the empty map. -
put
Unsupported.- Specified by:
putin interfaceTagged- Parameters:
key- ignoredvalue- ignored- Throws:
UnsupportedOperationException- always
-
get
Description copied from interface:TaggedReplies the value of the given key; null, if there is no value for this key -
remove
Unsupported.- Specified by:
removein interfaceTagged- Parameters:
key- ignored- Throws:
UnsupportedOperationException- always
-
hasKeys
Description copied from interface:TaggedReplies true, if there is at least one key/value pair; false, otherwise -
keySet
Description copied from interface:TaggedReplies the set of keys -
getNumKeys
Description copied from interface:TaggedGets the number of keys- Specified by:
getNumKeysin interfaceTagged- Returns:
- The number of keys set for this tagged object.
-
removeAll
Unsupported.- Specified by:
removeAllin interfaceTagged- Throws:
UnsupportedOperationException- always
-
isDirectionKey
true if this is a direction dependent tag (e.g. oneway)- Returns:
trueif this is is a direction dependent tag- Since:
- 10716
-