import net.pterodactylus.sone.data.Post;
import net.pterodactylus.sone.data.Sone;
+import com.google.common.base.Function;
import com.google.common.base.Optional;
/**
*/
public interface PostDatabase {
+ Function<String, Optional<Post>> getPost();
+
/**
* Returns the post with the given ID.
*
//
@Override
+ public Function<String, Optional<Post>> getPost() {
+ return new Function<String, Optional<Post>>() {
+ @Override
+ public Optional<Post> apply(String postId) {
+ return (postId == null) ? Optional.<Post>absent() : getPost(postId);
+ }
+ };
+ }
+
+ @Override
public Optional<Post> getPost(String postId) {
lock.readLock().lock();
try {