Change contract of Shell.getShelled().
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 12:42:01 +0000 (14:42 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 14 Oct 2010 12:42:01 +0000 (14:42 +0200)
src/main/java/net/pterodactylus/sone/data/PostShell.java
src/main/java/net/pterodactylus/sone/data/ReplyShell.java
src/main/java/net/pterodactylus/sone/data/Shell.java
src/main/java/net/pterodactylus/sone/data/SoneShell.java

index 36dba42..df66b20 100644 (file)
@@ -204,7 +204,7 @@ public class PostShell extends Post implements Shell<Post> {
                                post.addReply(reply);
                        }
                }
-               return null;
+               return this;
        }
 
 }
index fcab34a..03a4c53 100644 (file)
@@ -183,7 +183,7 @@ public class ReplyShell extends Reply implements Shell<Reply> {
                if (canUnshell()) {
                        return new Reply(sone, id, post, time, text);
                }
-               return null;
+               return this;
        }
 
 }
index 9f1fc9b..8d7068e 100644 (file)
@@ -36,11 +36,11 @@ public interface Shell<T> {
        public boolean canUnshell();
 
        /**
-        * Returns the object that is shelled. Returns {@code null} if the real
-        * object has not yet been retrieved.
+        * Returns the object that is shelled. This method with return the shell
+        * itself if {@link #canUnshell()} returns {@code false} and will return the
+        * real object once {@link #canUnshell()} returns true.
         *
-        * @return The shelled object, or {@code null} if the shelled object is not
-        *         retrieved yet
+        * @return The shelled object, or the shell itself
         */
        public T getShelled();
 
index 8b2f727..50b1189 100644 (file)
@@ -297,7 +297,7 @@ public class SoneShell extends Sone implements Shell<Sone> {
                        }
                        return sone;
                }
-               return null;
+               return this;
        }
 
 }