X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FIdentified.java;h=12e1b7217ff3d6e192c0f643d5180bbf8762eec1;hp=f12f842a7938981a8ba07848dee9f77ff0abfa9f;hb=5ab6ee01df9bac0c7bd5d27a6990dfdf60555d0f;hpb=f855be86d4d02a29c4603522c793a3b0eecc961c
diff --git a/src/main/java/net/pterodactylus/sone/data/Identified.java b/src/main/java/net/pterodactylus/sone/data/Identified.java
index f12f842..12e1b72 100644
--- a/src/main/java/net/pterodactylus/sone/data/Identified.java
+++ b/src/main/java/net/pterodactylus/sone/data/Identified.java
@@ -1,5 +1,5 @@
/*
- * Sone - Identified.java - Copyright © 2013 David Roden
+ * Sone - Identified.java - Copyright © 2013â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
@@ -17,13 +17,13 @@
package net.pterodactylus.sone.data;
+import javax.annotation.Nonnull;
+
import com.google.common.base.Function;
import com.google.common.base.Optional;
/**
* Interface for all objects that expose an ID.
- *
- * @author David âBombeâ Roden
*/
public interface Identified {
@@ -31,8 +31,9 @@ public interface Identified {
public static final Function, Optional> GET_ID = new Function, Optional>() {
@Override
+ @Nonnull
public Optional apply(Optional extends Identified> identified) {
- return identified.isPresent() ? Optional.of(identified.get().getId()) : Optional.absent();
+ return (identified == null) ? Optional.absent() : (identified.isPresent() ? Optional.of(identified.get().getId()) : Optional.absent());
}
};