Modifier and Type | Field and Description |
---|---|
private String |
key |
private String |
value |
Constructor and Description |
---|
Tag()
Create an empty tag whose key and value are empty.
|
Tag(String key)
Create a tag whose key is
key and whose value is
empty. |
Tag(String key,
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(Object obj) |
String |
getKey()
Replies the key of the tag.
|
String |
getValue()
Replies the value of the tag.
|
int |
hashCode() |
boolean |
matchesKey(String key)
Replies true if the key of this tag is equal to
key . |
static Tag |
ofString(String s)
This constructs a
Tag by splitting s on the first equality sign. |
static String |
removeWhiteSpaces(String s)
Removes leading, trailing, and multiple inner whitespaces from the given string, to be used as a key or value.
|
String |
toString() |
public Tag()
public Tag(String key)
key
and whose value is
empty.key
- the key. If null, it is set to the empty key.public Tag(String key, String value)
key
- the keyvalue
- the valuepublic String getKey()
public String getValue()
public boolean matchesKey(String key)
key
.
If key
is null, assumes the empty key.key
- the keykey
public static Tag ofString(String s)
Tag
by splitting s
on the first equality sign.s
- the string to convertTextTagParser
public static String removeWhiteSpaces(String s)
s
- The string