public class Tag extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
key |
private java.lang.String |
value |
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 |
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 . |
static Tag |
ofString(java.lang.String s)
This constructs a
Tag by splitting s on the first equality sign. |
static java.lang.String |
removeWhiteSpaces(java.lang.String s)
Removes leading, trailing, and multiple inner whitespaces from the given string, to be used as a key or value.
|
java.lang.String |
toString() |
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()
public java.lang.String getValue()
public boolean matchesKey(java.lang.String key)
key
.
If key
is null, assumes the empty key.key
- the keykey
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
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
public static java.lang.String removeWhiteSpaces(java.lang.String s)
s
- The string