From 81077b2ff62eb1c94d4215bbde324a0e9d03b561 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 9 Nov 2014 11:55:38 +0100 Subject: [PATCH] Add method to tell if a post has already been loaded. --- src/main/java/net/pterodactylus/sone/data/Post.java | 8 ++++++++ src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java | 5 +++++ .../java/net/pterodactylus/sone/database/memory/MemoryPost.java | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/data/Post.java b/src/main/java/net/pterodactylus/sone/data/Post.java index 63d4b77..09198fd 100644 --- a/src/main/java/net/pterodactylus/sone/data/Post.java +++ b/src/main/java/net/pterodactylus/sone/data/Post.java @@ -62,6 +62,14 @@ public interface Post extends Identified { public String getId(); /** + * Returns whether this post has already been loaded. + * + * @return {@code true} if this post has already been loaded, {@code + * false} otherwise + */ + boolean isLoaded(); + + /** * Returns the Sone this post belongs to. * * @return The Sone of this post diff --git a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java index 2d25715..4e6f6ba 100644 --- a/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java +++ b/src/main/java/net/pterodactylus/sone/data/impl/PostImpl.java @@ -91,6 +91,11 @@ public class PostImpl implements Post { return id.toString(); } + @Override + public boolean isLoaded() { + return true; + } + /** * {@inheritDoc} */ diff --git a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java index 22fa7e6..180cf6c 100644 --- a/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java +++ b/src/main/java/net/pterodactylus/sone/database/memory/MemoryPost.java @@ -94,6 +94,11 @@ class MemoryPost implements Post { return id.toString(); } + @Override + public boolean isLoaded() { + return true; + } + /** * {@inheritDoc} */ -- 2.7.4