/*
- * Sone - PlainTextPart.java - Copyright © 2011–2012 David Roden
+ * Sone - PlainTextPart.java - Copyright © 2011–2013 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
package net.pterodactylus.sone.text;
+import static com.google.common.base.Objects.equal;
+import static java.lang.String.format;
+
/**
* {@link Part} implementation that holds a single piece of text.
*
}
//
- // ACCESSORS
+ // PART METHODS
//
- /**
- * Returns the text of this part.
- *
- * @return The text of this part
- */
+ @Override
public String getText() {
return text;
}
+ @Override
+ public boolean isPlainText() {
+ return true;
+ }
+
+ @Override
+ public boolean isFreenetLink() {
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return text.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (!(object instanceof PlainTextPart)) {
+ return false;
+ }
+ PlainTextPart plainTextPart = (PlainTextPart) object;
+ return equal(getText(), plainTextPart.getText());
+ }
+
+ @Override
+ public String toString() {
+ return format("PlainText(%s)", getText());
+ }
+
}