diff options
author | 2016-12-07 18:56:43 +0700 | |
---|---|---|
committer | 2016-12-07 22:37:17 +0300 | |
commit | 69a5bdba32cdf0a48e51baa8c9fb28dca013f515 (patch) | |
tree | 678ca66ebd5e3c6e0e46f179542ff35fcf52c767 /juick-core/src/main/java/com/juick/Tag.java | |
parent | bad2718b1b85d806221fce52c76fa1d388993396 (diff) |
message improvenments, checking for tag's duplicates
Diffstat (limited to 'juick-core/src/main/java/com/juick/Tag.java')
-rw-r--r-- | juick-core/src/main/java/com/juick/Tag.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/juick-core/src/main/java/com/juick/Tag.java b/juick-core/src/main/java/com/juick/Tag.java index 98fe60ff..9675390b 100644 --- a/juick-core/src/main/java/com/juick/Tag.java +++ b/juick-core/src/main/java/com/juick/Tag.java @@ -23,6 +23,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; +import java.util.Comparator; import java.util.Objects; /** @@ -30,16 +31,12 @@ import java.util.Objects; */ @XmlRootElement(name = "tag", namespace = "http://juick.com/message") @XmlAccessorType(XmlAccessType.PROPERTY) -public class Tag { - private String name; +public class Tag implements Comparable<Tag> { + private final String name; public int TID = 0; public int SynonymID = 0; - public Tag() { - - } - public Tag(String name) { this.name = name; } @@ -61,7 +58,8 @@ public class Tag { return name; } - public void setName(String name) { - this.name = name; + @Override + public int compareTo(Tag o) { + return Objects.compare(name, o.getName(), Comparator.naturalOrder()); } } |