public class Tag extends java.lang.Object implements Tagged, java.util.Map.Entry<java.lang.String,java.lang.String>, java.io.Serializable
It implements the Tagged
interface. However, since instances of this class are immutable,
the modifying methods throw an UnsupportedOperationException
.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
key |
private static long |
serialVersionUID |
private java.lang.String |
value |
MAX_TAG_LENGTH
Constructor and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
get(java.lang.String k)
Replies the value of the given key; null, if there is no value for this key
|
java.lang.String |
getKey()
Replies the key of the tag.
|
java.util.Map<java.lang.String,java.lang.String> |
getKeys()
Replies the map of key/value pairs.
|
int |
getNumKeys()
Gets the number of keys
|
java.lang.String |
getValue()
Replies the value of the tag.
|
int |
hashCode() |
boolean |
hasKeys()
Replies true, if there is at least one key/value pair; false, otherwise
|
boolean |
isDirectionKey()
true if this is a direction dependent tag (e.g.
|
java.util.Collection<java.lang.String> |
keySet()
Replies the set of keys
|
boolean |
matchesKey(java.lang.String key)
Replies true if the key of this tag is equal to
key . |
static Tag |
ofString(java.lang.String s)
This constructs a
Tag by splitting s on the first equality sign. |
void |
put(java.lang.String key,
java.lang.String value)
Unsupported.
|
void |
remove(java.lang.String key)
Unsupported.
|
void |
removeAll()
Unsupported.
|
static java.lang.String |
removeWhiteSpaces(java.lang.String s)
Deprecated.
since 13597. Use
Utils.removeWhiteSpaces(String) instead |
void |
setKeys(java.util.Map<java.lang.String,java.lang.String> keys)
Unsupported.
|
java.lang.String |
setValue(java.lang.String value)
This is not supported by this implementation.
|
java.lang.String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
hasKey, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, put, visitKeys
private static final long serialVersionUID
private final java.lang.String key
private final java.lang.String value
public Tag()
public Tag(java.lang.String key)
key
and whose value is
empty.key
- the key. If null, it is set to the empty key.public Tag(java.lang.String key, java.lang.String value)
key
- the keyvalue
- the valuepublic java.lang.String getKey()
getKey
in interface java.util.Map.Entry<java.lang.String,java.lang.String>
public java.lang.String getValue()
getValue
in interface java.util.Map.Entry<java.lang.String,java.lang.String>
public java.lang.String setValue(java.lang.String value)
setValue
in interface java.util.Map.Entry<java.lang.String,java.lang.String>
value
- ignoredjava.lang.UnsupportedOperationException
- alwayspublic boolean matchesKey(java.lang.String key)
key
.
If key
is null, assumes the empty key.key
- the keykey
public int hashCode()
hashCode
in interface java.util.Map.Entry<java.lang.String,java.lang.String>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in interface java.util.Map.Entry<java.lang.String,java.lang.String>
equals
in class java.lang.Object
public static Tag ofString(java.lang.String s)
Tag
by splitting s
on the first equality sign.s
- the string to convertTextTagParser
public java.lang.String toString()
toString
in class java.lang.Object
@Deprecated public static java.lang.String removeWhiteSpaces(java.lang.String s)
Utils.removeWhiteSpaces(String)
insteads
- The stringpublic void setKeys(java.util.Map<java.lang.String,java.lang.String> keys)
public java.util.Map<java.lang.String,java.lang.String> getKeys()
Tagged
public void put(java.lang.String key, java.lang.String value)
public java.lang.String get(java.lang.String k)
Tagged
public void remove(java.lang.String key)
public boolean hasKeys()
Tagged
public java.util.Collection<java.lang.String> keySet()
Tagged
public final int getNumKeys()
Tagged
getNumKeys
in interface Tagged
public void removeAll()
public boolean isDirectionKey()
true
if this is is a direction dependent tag