Fix static import.
[Sone.git] / src / main / java / net / pterodactylus / sone / data / Sone.java
index eb52860..31153ff 100644 (file)
@@ -17,7 +17,7 @@
 
 package net.pterodactylus.sone.data;
 
-import static com.google.common.base.Preconditions.*;
+import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.collect.FluentIterable.from;
 import static java.util.Arrays.asList;
 import static net.pterodactylus.sone.data.Album.FLATTENER;
@@ -54,7 +54,7 @@ import com.google.common.primitives.Ints;
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
-public class Sone implements Fingerprintable, Comparable<Sone> {
+public class Sone implements Identified, Fingerprintable, Comparable<Sone> {
 
        /**
         * Enumeration for the possible states of a {@link Sone}.
@@ -155,7 +155,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
 
                @Override
                public boolean apply(Sone sone) {
-                       return sone.getTime() != 0;
+                       return (sone == null) ? false : sone.getTime() != 0;
                }
        };
 
@@ -164,7 +164,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
 
                @Override
                public boolean apply(Sone sone) {
-                       return sone.getIdentity() instanceof OwnIdentity;
+                       return (sone == null) ? false : sone.getIdentity() instanceof OwnIdentity;
                }
 
        };
@@ -174,7 +174,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
 
                @Override
                public boolean apply(Sone sone) {
-                       return !sone.getRootAlbum().getAlbums().isEmpty();
+                       return (sone == null) ? false : !sone.getRootAlbum().getAlbums().isEmpty();
                }
        };
 
@@ -875,7 +875,7 @@ public class Sone implements Fingerprintable, Comparable<Sone> {
        /** {@inheritDoc} */
        @Override
        public String toString() {
-               return getClass().getName() + "[identity=" + identity + ",requestUri=" + requestUri + ",insertUri(" + String.valueOf(insertUri).length() + "),friends(" + friendSones.size() + "),posts(" + posts.size() + "),replies(" + replies.size() + ")]";
+               return getClass().getName() + "[identity=" + identity + ",requestUri=" + requestUri + ",insertUri(" + String.valueOf(insertUri).length() + "),friends(" + friendSones.size() + "),posts(" + posts.size() + "),replies(" + replies.size() + "),albums(" + getRootAlbum().getAlbums().size() + ")]";
        }
 
 }