/*
- * Sone - PostLinkPart.java - Copyright © 2011–2012 David Roden
+ * Sone - PostPart.java - Copyright © 2011–2016 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 java.util.Objects;
+
+import javax.annotation.Nonnull;
+
import net.pterodactylus.sone.data.Post;
/**
* {@link Part} implementation that stores a reference to a {@link Post}.
- *
- * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
*/
public class PostPart implements Part {
- /** The post this part refers to. */
private final Post post;
- /**
- * Creates a new post part.
- *
- * @param post
- * The referenced post
- */
- public PostPart(Post post) {
- this.post = post;
+ public PostPart(@Nonnull Post post) {
+ this.post = Objects.requireNonNull(post);
}
- //
- // ACCESSORS
- //
-
- /**
- * Returns the post referenced by this part.
- *
- * @return The post referenced by this part
- */
+ @Nonnull
public Post getPost() {
return post;
}
+ @Override
+ public String getText() {
+ return post.getText();
+ }
+
}