diff --git a/src/main/java/world/bentobox/bentobox/database/AbstractDatabaseHandler.java b/src/main/java/world/bentobox/bentobox/database/AbstractDatabaseHandler.java index 95772b0ad..e94e867e9 100644 --- a/src/main/java/world/bentobox/bentobox/database/AbstractDatabaseHandler.java +++ b/src/main/java/world/bentobox/bentobox/database/AbstractDatabaseHandler.java @@ -4,6 +4,8 @@ import java.beans.IntrospectionException; import java.lang.reflect.InvocationTargetException; import java.util.List; +import org.eclipse.jdt.annotation.NonNull; +import org.eclipse.jdt.annotation.Nullable; import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.addons.Addon; @@ -38,12 +40,14 @@ public abstract class AbstractDatabaseHandler { /** * The addon that is accessing the database, if any. */ + @Nullable private Addon addon; /** * Get the addon that is accessing the database, if any. May be null. * @return the addon */ + @Nullable public Addon getAddon() { return addon; } @@ -52,7 +56,7 @@ public abstract class AbstractDatabaseHandler { * Set the addon that is accessing the database, if any. * @param addon the addon to set */ - public void setAddon(Addon addon) { + public void setAddon(@Nullable Addon addon) { this.addon = addon; } @@ -84,7 +88,8 @@ public abstract class AbstractDatabaseHandler { * @param uniqueId - unique ID * @return */ - public abstract T loadObject(String uniqueId) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException, NoSuchMethodException; + @Nullable + public abstract T loadObject(@NonNull String uniqueId) throws InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, IntrospectionException, NoSuchMethodException; /** * Save T into the corresponding database @@ -115,6 +120,7 @@ public abstract class AbstractDatabaseHandler { * Attempts to delete the object with the uniqueId * @param uniqueId - uniqueId of object * @return true if successful, false if there is no such uniqueId + * @since 1.1 */ public abstract boolean deleteID(String uniqueId); } diff --git a/src/main/java/world/bentobox/bentobox/database/Database.java b/src/main/java/world/bentobox/bentobox/database/Database.java index 21d1739e0..343848edf 100644 --- a/src/main/java/world/bentobox/bentobox/database/Database.java +++ b/src/main/java/world/bentobox/bentobox/database/Database.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; +import org.eclipse.jdt.annotation.NonNull; import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.api.addons.Addon; @@ -44,6 +45,7 @@ public class Database { * Load all the config objects and supply them as a list * @return list of config objects or an empty list if they cannot be loaded */ + @NonNull public List loadObjects() { List result = new ArrayList<>(); try {