diff --git a/src/main/java/org/kiwiproject/jaxrs/KiwiResources.java b/src/main/java/org/kiwiproject/jaxrs/KiwiResources.java index 8fa435eb..46b516ed 100644 --- a/src/main/java/org/kiwiproject/jaxrs/KiwiResources.java +++ b/src/main/java/org/kiwiproject/jaxrs/KiwiResources.java @@ -16,6 +16,7 @@ import jakarta.ws.rs.core.Response; import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; +import org.checkerframework.checker.nullness.qual.NonNull; import org.kiwiproject.base.KiwiStrings; import org.kiwiproject.jaxrs.exception.JaxrsBadRequestException; import org.kiwiproject.jaxrs.exception.JaxrsNotFoundException; @@ -67,6 +68,7 @@ public static void verifyExistence(T resourceEntity) { * @return the entity if the Optional contains a value * @throws JaxrsNotFoundException if the entity is empty */ + @NonNull public static T verifyExistence(Optional resourceEntity) { verifyExistence(resourceEntity.orElse(null), null); @@ -97,6 +99,7 @@ public static void verifyExistence(T resourceEntity, Class entityType, Ob * @return the entity if the Optional contains a value * @throws JaxrsNotFoundException if the entity is empty */ + @NonNull public static T verifyExistence(Optional resourceEntity, Class entityType, Object identifier) { var notFoundMessage = JaxrsNotFoundException.buildMessage(entityType.getSimpleName(), identifier); verifyExistence(resourceEntity.orElse(null), notFoundMessage); @@ -145,6 +148,7 @@ public static void verifyExistence(T resourceEntity, String notFoundMessageT * @return the entity if the Optional contains a value * @throws JaxrsNotFoundException if the entity is empty */ + @NonNull public static T verifyExistence(Optional resourceEntity, String notFoundMessage) { verifyExistence(resourceEntity.orElse(null), notFoundMessage); @@ -163,6 +167,7 @@ public static T verifyExistence(Optional resourceEntity, String notFoundM * @return the entity if the Optional contains a value * @throws JaxrsNotFoundException if the entity is empty */ + @NonNull public static T verifyExistence(Optional resourceEntity, String notFoundMessageTemplate, Object... args) { verifyExistence(resourceEntity.orElse(null), notFoundMessageTemplate, args);