org.openstreetmap.josm.data.osm
Class Tag

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.Tag

public class Tag
extends java.lang.Object

Tag represents an immutable key/value-pair. Both the key and the value may be empty, but not null.


Field Summary
private  java.lang.String key
           
private  java.lang.String value
           
 
Constructor Summary
Tag()
          Create an empty tag whose key and value are empty.
Tag(java.lang.String key)
          Create a tag whose key is key and whose value is empty.
Tag(java.lang.String key, java.lang.String value)
          Creates a tag for a key and a value.
Tag(Tag tag)
          Creates clone of the tag tag.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getKey()
          Replies the key of the tag.
 java.lang.String getValue()
          Replies the value of the tag.
 int hashCode()
           
 boolean matchesKey(java.lang.String key)
          Replies true if the key of this tag is equal to key.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

key

private java.lang.String key

value

private java.lang.String value
Constructor Detail

Tag

public Tag()
Create an empty tag whose key and value are empty.


Tag

public Tag(java.lang.String key)
Create a tag whose key is key and whose value is empty.

Parameters:
key - the key. If null, it is set to the empty key.

Tag

public Tag(java.lang.String key,
           java.lang.String value)
Creates a tag for a key and a value. If key and/or value are null, the empty value "" is assumed.

Parameters:
key - the key
value - the value

Tag

public Tag(Tag tag)
Creates clone of the tag tag.

Parameters:
tag - the tag.
Method Detail

getKey

public java.lang.String getKey()
Replies the key of the tag. This is never null.

Returns:
the key of the tag

getValue

public java.lang.String getValue()
Replies the value of the tag. This is never null.

Returns:
the value of the tag

matchesKey

public boolean matchesKey(java.lang.String key)
Replies true if the key of this tag is equal to key. If key is null, assumes the empty key.

Parameters:
key - the key
Returns:
true if the key of this tag is equal to key

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


JOSM