This is an automated email from the ASF dual-hosted git repository. mbo pushed a commit to branch JDO-777 in repository https://gitbox.apache.org/repos/asf/db-jdo.git
commit 371fbdd7a77a2da8266f809b301c34992e94e77d Author: Michael Bouschen <m...@apache.org> AuthorDate: Sun Feb 17 22:48:40 2019 +0100 JDO-777: Adding overloaded methods to JDOQLTypedQuery: numericParameter, collectionParameter, mapParameter, and listParameter --- api/src/main/java/javax/jdo/JDOQLTypedQuery.java | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/api/src/main/java/javax/jdo/JDOQLTypedQuery.java b/api/src/main/java/javax/jdo/JDOQLTypedQuery.java index 95b8446..12aaec8 100644 --- a/api/src/main/java/javax/jdo/JDOQLTypedQuery.java +++ b/api/src/main/java/javax/jdo/JDOQLTypedQuery.java @@ -90,6 +90,17 @@ public interface JDOQLTypedQuery<T> extends Serializable, Closeable { NumericExpression<?> numericParameter(String name); /** + * Method to return a numeric parameter for the query. + * @param name Name of the parameter + * @param type Type of the numeric parameter + * @param <N> Type for the numeric parameter + * @return NumericExpression for the parameter + */ + default <N> NumericExpression<N> numericParameter(String name, Class<N> type) { + return (NumericExpression<N>)numericParameter(name); + } + + /** * Method to return a date parameter for the query. * @param name Name of the parameter * @return Expression for the parameter @@ -118,6 +129,18 @@ public interface JDOQLTypedQuery<T> extends Serializable, Closeable { CollectionExpression<?, ?> collectionParameter(String name); /** + * Method to return a collection parameter for the query. + * + * @param name Name of the parameter + * @param elementType Element type of the collection parameter + * @param <E> Element type for the collection parameter + * @return Expression for the parameter + */ + default <E> CollectionExpression<Collection<E>, E> collectionParameter(String name, Class<E> elementType) { + return (CollectionExpression<Collection<E>, E>)collectionParameter(name); + } + + /** * Method to return a map parameter for the query. * @param name Name of the parameter * @return Expression for the parameter @@ -125,6 +148,19 @@ public interface JDOQLTypedQuery<T> extends Serializable, Closeable { MapExpression<?, ?, ?> mapParameter(String name); /** + * Method to return a map parameter for the query. + * @param name Name of the parameter + * @param keyType Key type of the map parameter + * @param valueType Value type of the map parameter + * @param <K> Key type for the map parameter + * @param <V> Value type for the map parameter + * @return Expression for the parameter + */ + default <K,V> MapExpression<Map<K,V>, K, V> mapParameter(String name, Class<K> keyType, Class<V> valueType) { + return (MapExpression<Map<K,V>, K, V>)mapParameter(name); + } + + /** * Method to return a list parameter for the query. * @param name Name of the parameter * @return Expression for the parameter @@ -132,6 +168,17 @@ public interface JDOQLTypedQuery<T> extends Serializable, Closeable { ListExpression<?, ?> listParameter(String name); /** + * Method to return a list parameter for the query. + * @param name Name of the parameter + * @param elementType Element type of the list parameter + * @param <E> Element type for the list parameter + * @return + */ + default <E> ListExpression<List<E>, E> listParameter(String name, Class<E> elementType) { + return (ListExpression<List<E>, E>)listParameter(name); + } + + /** * Method to return a variable for this query. * Cast the returned variable to the right type to be able to call methods on it. * @param name Name of the variable