diff --git a/pom.xml b/pom.xml index 99d20c71a..cec97b66d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ io.ebean ebean - 11.3.2-SNAPSHOT + 11.4.1-SNAPSHOT jar ebean @@ -72,10 +72,15 @@ + - org.jetbrains - annotations - 13.0 + io.ebean + ebean-jsr305 + 1.1 + provided diff --git a/src/main/java/io/ebean/DocumentStore.java b/src/main/java/io/ebean/DocumentStore.java index d96b8d430..f9cb809ee 100644 --- a/src/main/java/io/ebean/DocumentStore.java +++ b/src/main/java/io/ebean/DocumentStore.java @@ -2,7 +2,7 @@ package io.ebean; import io.ebeanservice.docstore.api.DocQueryRequest; import io.ebeanservice.docstore.api.RawDoc; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import java.io.IOException; import java.util.List; diff --git a/src/main/java/io/ebean/Ebean.java b/src/main/java/io/ebean/Ebean.java index f01b74490..edb4a5d6f 100644 --- a/src/main/java/io/ebean/Ebean.java +++ b/src/main/java/io/ebean/Ebean.java @@ -5,7 +5,7 @@ import io.ebean.cache.ServerCacheManager; import io.ebean.config.ServerConfig; import io.ebean.text.csv.CsvReader; import io.ebean.text.json.JsonContext; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/io/ebean/EbeanServer.java b/src/main/java/io/ebean/EbeanServer.java index 75316bf0f..80a798936 100644 --- a/src/main/java/io/ebean/EbeanServer.java +++ b/src/main/java/io/ebean/EbeanServer.java @@ -7,7 +7,9 @@ import io.ebean.meta.MetaInfoManager; import io.ebean.plugin.SpiServer; import io.ebean.text.csv.CsvReader; import io.ebean.text.json.JsonContext; -import org.jetbrains.annotations.Nullable; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.persistence.NonUniqueResultException; import javax.persistence.OptimisticLockException; @@ -732,6 +734,7 @@ public interface EbeanServer { * @param beanType the type of entity bean to fetch * @param id the id value */ + @Nullable T find(Class beanType, Object id); /** @@ -775,6 +778,7 @@ public interface EbeanServer { * @param beanType the type of entity bean * @param id the id value */ + @Nonnull T getReference(Class beanType, Object id); /** @@ -790,6 +794,7 @@ public interface EbeanServer { * * @see Query#findIds() */ + @Nonnull List findIds(Query query, Transaction transaction); /** @@ -809,6 +814,7 @@ public interface EbeanServer { * @see Query#findEach(Consumer) * @see Query#findEachWhile(Predicate) */ + @Nonnull QueryIterator findIterate(Query query, Transaction transaction); /** @@ -885,6 +891,7 @@ public interface EbeanServer { * It will execute the query against the history returning the versions of the bean. *

*/ + @Nonnull List> findVersions(Query query, Transaction transaction); /** @@ -910,6 +917,7 @@ public interface EbeanServer { * @return the list of fetched beans. * @see Query#findList() */ + @Nonnull List findList(Query query, Transaction transaction); /** @@ -925,6 +933,7 @@ public interface EbeanServer { * @return a Future object for the row count query * @see Query#findFutureCount() */ + @Nonnull FutureRowCount findFutureCount(Query query, Transaction transaction); /** @@ -940,6 +949,7 @@ public interface EbeanServer { * @return a Future object for the list of Id's * @see Query#findFutureIds() */ + @Nonnull FutureIds findFutureIds(Query query, Transaction transaction); /** @@ -956,6 +966,7 @@ public interface EbeanServer { * @return a Future object for the list result of the query * @see Query#findFutureList() */ + @Nonnull FutureList findFutureList(Query query, Transaction transaction); /** @@ -987,6 +998,7 @@ public interface EbeanServer { * @return The PagedList * @see Query#findPagedList() */ + @Nonnull PagedList findPagedList(Query query, Transaction transaction); /** @@ -1012,6 +1024,7 @@ public interface EbeanServer { * @return the set of fetched beans. * @see Query#findSet() */ + @Nonnull Set findSet(Query query, Transaction transaction); /** @@ -1028,6 +1041,7 @@ public interface EbeanServer { * @return the map of fetched beans. * @see Query#findMap() */ + @Nonnull Map findMap(Query query, Transaction transaction); /** @@ -1060,6 +1074,7 @@ public interface EbeanServer { * @return the list of values for the selected property * @see Query#findSingleAttributeList() */ + @Nonnull List
findSingleAttributeList(Query query, Transaction transaction); /** @@ -1087,6 +1102,7 @@ public interface EbeanServer { /** * Similar to findOne() but returns an Optional (rather than nullable). */ + @Nonnull Optional findOneOrEmpty(Query query, Transaction transaction); /** @@ -1143,6 +1159,7 @@ public interface EbeanServer { * @return the list of fetched MapBean. * @see SqlQuery#findList() */ + @Nonnull List findList(SqlQuery query, Transaction transaction); /** diff --git a/src/main/java/io/ebean/ExpressionList.java b/src/main/java/io/ebean/ExpressionList.java index 348c2e5a2..67a7e249a 100644 --- a/src/main/java/io/ebean/ExpressionList.java +++ b/src/main/java/io/ebean/ExpressionList.java @@ -5,8 +5,9 @@ import io.ebean.search.MultiMatch; import io.ebean.search.TextCommonTerms; import io.ebean.search.TextQueryString; import io.ebean.search.TextSimple; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; +import javax.annotation.Nonnull; import javax.persistence.NonUniqueResultException; import java.sql.Timestamp; import java.util.Collection; @@ -192,6 +193,7 @@ public interface ExpressionList { * * @see Query#findList() */ + @Nonnull List findList(); /** @@ -199,6 +201,7 @@ public interface ExpressionList { * * @see Query#findIds() */ + @Nonnull List findIds(); /** @@ -214,6 +217,7 @@ public interface ExpressionList { * * @see Query#findSet() */ + @Nonnull Set findSet(); /** @@ -221,6 +225,7 @@ public interface ExpressionList { * * @see Query#findMap() */ + @Nonnull Map findMap(); /** @@ -253,6 +258,7 @@ public interface ExpressionList { * * @return the list of values for the selected property */ + @Nonnull List findSingleAttributeList(); /** @@ -272,6 +278,7 @@ public interface ExpressionList { /** * Execute the query returning an optional bean. */ + @Nonnull Optional findOneOrEmpty(); /** @@ -297,6 +304,7 @@ public interface ExpressionList { * * @return a Future object for the row count query */ + @Nonnull FutureRowCount findFutureCount(); /** @@ -309,6 +317,7 @@ public interface ExpressionList { * * @return a Future object for the list of Id's */ + @Nonnull FutureIds findFutureIds(); /** @@ -321,6 +330,7 @@ public interface ExpressionList { * * @return a Future object for the list result of the query */ + @Nonnull FutureList findFutureList(); /** @@ -352,6 +362,7 @@ public interface ExpressionList { * @return The PagedList * @see Query#findPagedList() */ + @Nonnull PagedList findPagedList(); /** @@ -361,6 +372,7 @@ public interface ExpressionList { * It will execute the query against the history returning the versions of the bean. *

*/ + @Nonnull List> findVersions(); /** @@ -370,11 +382,13 @@ public interface ExpressionList { * It will execute the query against the history returning the versions of the bean. *

*/ + @Nonnull List> findVersionsBetween(Timestamp start, Timestamp end); /** * Add some filter predicate expressions to the many property. */ + @Nonnull ExpressionList filterMany(String prop); /** diff --git a/src/main/java/io/ebean/Finder.java b/src/main/java/io/ebean/Finder.java index 618e90ef2..bcba9667a 100644 --- a/src/main/java/io/ebean/Finder.java +++ b/src/main/java/io/ebean/Finder.java @@ -1,6 +1,7 @@ package io.ebean; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.util.List; @@ -132,6 +133,7 @@ public class Finder { *

* Equivalent to {@link EbeanServer#getReference(Class, Object)} */ + @Nonnull public T ref(I id) { return db().getReference(type, id); } @@ -158,6 +160,7 @@ public class Finder { /** * Retrieves all entities of the given type. */ + @Nonnull public List all() { return query().findList(); } diff --git a/src/main/java/io/ebean/PagedList.java b/src/main/java/io/ebean/PagedList.java index be820cb06..421fde776 100644 --- a/src/main/java/io/ebean/PagedList.java +++ b/src/main/java/io/ebean/PagedList.java @@ -1,5 +1,6 @@ package io.ebean; +import javax.annotation.Nonnull; import java.util.List; import java.util.concurrent.Future; @@ -109,11 +110,13 @@ public interface PagedList { * * } */ + @Nonnull Future getFutureCount(); /** * Return the list of entities for this page. */ + @Nonnull List getList(); /** diff --git a/src/main/java/io/ebean/Query.java b/src/main/java/io/ebean/Query.java index b69bc778e..4d97bf7d9 100644 --- a/src/main/java/io/ebean/Query.java +++ b/src/main/java/io/ebean/Query.java @@ -1,7 +1,7 @@ package io.ebean; -import org.jetbrains.annotations.Nullable; - +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import javax.persistence.NonUniqueResultException; import java.sql.Timestamp; import java.util.List; @@ -597,6 +597,7 @@ public interface Query { * * @see EbeanServer#findIds(Query, Transaction) */ + @Nonnull List findIds(); /** @@ -637,6 +638,7 @@ public interface Query { * * } */ + @Nonnull QueryIterator findIterate(); /** @@ -735,6 +737,7 @@ public interface Query { * * @see EbeanServer#findList(Query, Transaction) */ + @Nonnull List findList(); /** @@ -753,6 +756,7 @@ public interface Query { * * @see EbeanServer#findSet(Query, Transaction) */ + @Nonnull Set findSet(); /** @@ -775,6 +779,7 @@ public interface Query { * * @see EbeanServer#findMap(Query, Transaction) */ + @Nonnull Map findMap(); /** @@ -807,6 +812,7 @@ public interface Query { * * @return the list of values for the selected property */ + @Nonnull List findSingleAttributeList(); /** @@ -855,6 +861,7 @@ public interface Query { /** * Execute the query returning an optional bean. */ + @Nonnull Optional findOneOrEmpty(); /** @@ -882,6 +889,7 @@ public interface Query { * It will execute the query against the history returning the versions of the bean. *

*/ + @Nonnull List> findVersions(); /** @@ -891,6 +899,7 @@ public interface Query { * It will execute the query against the history returning the versions of the bean. *

*/ + @Nonnull List> findVersionsBetween(Timestamp start, Timestamp end); /** @@ -928,6 +937,7 @@ public interface Query { * * @return a Future object for the row count query */ + @Nonnull FutureRowCount findFutureCount(); /** @@ -940,6 +950,7 @@ public interface Query { * * @return a Future object for the list of Id's */ + @Nonnull FutureIds findFutureIds(); /** @@ -951,6 +962,7 @@ public interface Query { * * @return a Future object for the list result of the query */ + @Nonnull FutureList findFutureList(); /** @@ -980,6 +992,7 @@ public interface Query { * * @return The PagedList */ + @Nonnull PagedList findPagedList(); /** diff --git a/src/main/java/io/ebean/SqlQuery.java b/src/main/java/io/ebean/SqlQuery.java index 3c568bd0a..d59e14b9d 100644 --- a/src/main/java/io/ebean/SqlQuery.java +++ b/src/main/java/io/ebean/SqlQuery.java @@ -1,5 +1,7 @@ package io.ebean; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.io.Serializable; import java.util.List; import java.util.Optional; @@ -43,6 +45,7 @@ public interface SqlQuery extends Serializable { /** * Execute the query returning a list. */ + @Nonnull List findList(); /** @@ -71,16 +74,19 @@ public interface SqlQuery extends Serializable { * PersistenceException. *

*/ + @Nullable SqlRow findOne(); /** * Execute the query returning an optional row. */ + @Nonnull Optional findOneOrEmpty(); /** * Deprecated - please migrate to findOne(). */ + @Nullable @Deprecated default SqlRow findUnique() { return findOne();