}
/**
- * Returns the text of this part.
+ * Returns the title of this part.
*
- * @return The text of this part
+ * @return The title of this part
*/
- public String getText() {
- return text;
+ public String getTitle() {
+ return title;
}
+ //
+ // PART METHODS
+ //
+
/**
- * Returns the title of this part.
+ * Returns the text of this part.
*
- * @return The title of this part
+ * @return The text of this part
*/
- public String getTitle() {
- return title;
+ @Override
+ public String getText() {
+ return text;
}
}
*/
public interface Part {
- /* no methods. */
+ /**
+ * Returns the text contained in this part. This should return plain text
+ * without any format information.
+ *
+ * @return The plain text of this part
+ */
+ public String getText();
}
}
//
+ // PART METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText() {
+ StringBuilder partText = new StringBuilder();
+ for (Part part : parts) {
+ partText.append(part.getText());
+ }
+ return partText.toString();
+ }
+
+ //
// ITERABLE METHODS
//
}
//
- // ACCESSORS
+ // PART METHODS
//
/**
*
* @return The text of this part
*/
+ @Override
public String getText() {
return text;
}
return post;
}
+ //
+ // PART METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText() {
+ return post.getText();
+ }
+
}
package net.pterodactylus.sone.text;
import net.pterodactylus.sone.data.Sone;
+import net.pterodactylus.sone.template.SoneAccessor;
/**
* {@link Part} implementation that stores a reference to a {@link Sone}.
return sone;
}
+ //
+ // PART METHODS
+ //
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getText() {
+ return SoneAccessor.getNiceName(sone);
+ }
+
}