db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject svn commit: r1686466 - in /db/jdo/trunk/api/src/java/javax/jdo: PersistenceManager.java Query.java QueryExecution.java
Date Fri, 19 Jun 2015 17:45:44 GMT
Author: andyj
Date: Fri Jun 19 17:45:43 2015
New Revision: 1686466

URL: http://svn.apache.org/r1686466
Log:
JDO-736 Moved methods from QueryExecution to Query. Not yet addressed parameters, or result.
JDO-652 Added method to PersistenceManager to create JDOQLTypedQuery.
JDO-736 Added generics to PersistenceManager newQuery methods for candidate type

Removed:
    db/jdo/trunk/api/src/java/javax/jdo/QueryExecution.java
Modified:
    db/jdo/trunk/api/src/java/javax/jdo/PersistenceManager.java
    db/jdo/trunk/api/src/java/javax/jdo/Query.java

Modified: db/jdo/trunk/api/src/java/javax/jdo/PersistenceManager.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/PersistenceManager.java?rev=1686466&r1=1686465&r2=1686466&view=diff
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/PersistenceManager.java (original)
+++ db/jdo/trunk/api/src/java/javax/jdo/PersistenceManager.java Fri Jun 19 17:45:43 2015
@@ -158,12 +158,14 @@ public interface PersistenceManager exte
      */
     void refreshAll (JDOException jdoe);
     
-    /** Create a new <code>Query</code> with no elements.
+    /**
+     * Create a new <code>Query</code> with no elements.
      * @return the new <code>Query</code>.
      */
     Query newQuery ();
-    
-    /** Create a new <code>Query</code> using elements from another 
+
+    /**
+     * Create a new <code>Query</code> using elements from another 
      * <code>Query</code>. The other <code>Query</code> must have
been created 
      * by the same JDO implementation. It might be active in a different 
      * <code>PersistenceManager</code> or might have been serialized and 
@@ -172,65 +174,74 @@ public interface PersistenceManager exte
      * <code>Query</code>, except for the candidate <code>Collection</code>
or 
      * <code>Extent</code>.
      * @return the new <code>Query</code>
-     * @param compiled another <code>Query</code> from the same JDO 
-     * implementation
+     * @param compiled another <code>Query</code> from the same JDO implementation
      */
     Query newQuery (Object compiled);
-    
-    /** Create a Construct a new query instance using the specified String 
+
+    /**
+     * Create a Construct a new query instance using the specified String 
      * as the single-string representation of the query.
      * @param query the single-string query
      * @return the new <code>Query</code>
      * @since 2.0
      */
     Query newQuery (String query);
-    
+
     /** Create a new <code>Query</code> using the specified language.
      * @param language the language of the query parameter
      * @param query the query, which is of a form determined by the language
      * @return the new <code>Query</code>
      */    
     Query newQuery (String language, Object query);
-    
-    /** Create a new <code>Query</code> specifying the <code>Class</code>
of the 
+
+    /**
+     * Create a new <code>Query</code> specifying the <code>Class</code>
of the 
      * candidate instances.
      * @param cls the <code>Class</code> of the candidate instances
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
      */
-    Query newQuery (Class cls);
-    
-    /** Create a new <code>Query</code> with the <code>Class</code>
of the
+    <T> Query<T> newQuery (Class<T> cls);
+
+    /**
+     * Create a new <code>Query</code> with the <code>Class</code>
of the
      * candidate instances and candidate <code>Extent</code>.
      * @param cln the <code>Extent</code> of candidate instances
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
      */
-    Query newQuery (Extent cln);
+    <T> Query<T> newQuery (Extent<T> cln);
     
-    /** Create a new <code>Query</code> with the candidate <code>Class</code>

+    /**
+     * Create a new <code>Query</code> with the candidate <code>Class</code>

      * and <code>Collection</code>.
      * @param cls the <code>Class</code> of results
      * @param cln the <code>Collection</code> of candidate instances
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
      */
-    Query newQuery (Class cls, Collection cln);
+    <T> Query<T> newQuery (Class<T> cls, Collection<T> cln);
     
-    /** Create a new <code>Query</code> with the <code>Class</code>
of the
+    /**
+     * Create a new <code>Query</code> with the <code>Class</code>
of the
      * candidate instances and filter.
      * @param cls the <code>Class</code> of results
      * @param filter the filter for candidate instances
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
      */
-    Query newQuery (Class cls, String filter);
+    <T> Query<T> newQuery (Class<T> cls, String filter);
     
-    /** Create a new <code>Query</code> with the <code>Class</code>
of the 
-     * candidate instances, 
+    /**
+     * Create a new <code>Query</code> with the <code>Class</code>
of the candidate instances, 
      * candidate <code>Collection</code>, and filter.
      * @param cls the <code>Class</code> of candidate instances
      * @param cln the <code>Collection</code> of candidate instances
      * @param filter the filter for candidate instances
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
      */
-    Query newQuery (Class cls, Collection cln, String filter);
+    <T> Query<T> newQuery (Class<T> cls, Collection<T> cln, String
filter);
     
     /** Create a new <code>Query</code> with the
      * candidate <code>Extent</code> and filter; the class
@@ -238,8 +249,18 @@ public interface PersistenceManager exte
      * @param cln the <code>Extent</code> of candidate instances
      * @param filter the filter for candidate instances
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
+     */
+    <T> Query<T> newQuery (Extent<T> cln, String filter);
+
+    /**
+     * Create a new <code>JDOQLTypedQuery</code> with the specified candidate
class.
+     * @param cls Candidate class for the query
+     * @return The JDOQLTypedQuery
+     * @param <T> Candidate type for the query
+     * @since 3.2
      */
-    Query newQuery (Extent cln, String filter);
+    <T> JDOQLTypedQuery<T> newJDOQLTypedQuery(Class<T> cls);
 
     /**
      * Create a new <code>Query</code> with the given candidate class
@@ -248,8 +269,9 @@ public interface PersistenceManager exte
      * @param cls the <code>Class</code> of candidate instances
      * @param queryName the name of the query to look up in metadata
      * @return the new <code>Query</code>
+     * @param <T> Candidate type for the query
      */
-    Query newNamedQuery (Class cls, String queryName);
+    <T> Query<T> newNamedQuery (Class<T> cls, String queryName);
 
     /** The <code>PersistenceManager</code> manages a collection of instances
in
      * the data store based on the class of the instances.  This method returns

Modified: db/jdo/trunk/api/src/java/javax/jdo/Query.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api/src/java/javax/jdo/Query.java?rev=1686466&r1=1686465&r2=1686466&view=diff
==============================================================================
--- db/jdo/trunk/api/src/java/javax/jdo/Query.java (original)
+++ db/jdo/trunk/api/src/java/javax/jdo/Query.java Fri Jun 19 17:45:43 2015
@@ -23,6 +23,7 @@ package javax.jdo;
 
 import java.io.Serializable;
 import java.util.Collection;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -976,4 +977,44 @@ public interface Query<T> extends AutoCl
      * @return This query
      */
     Query<T> extensions(Map values);
+
+    /**
+     * Method to execute the query where there are (potentially) multiple rows and we are
returning the candidate type.
+     * @return The List of candidate objects
+     */
+    List<T> executeList();
+
+    /**
+     * Method to execute the query where there is a single row and we are returning the candidate
type.
+     * @return The candidate object returned by the query (or null)
+     */
+    T executeUnique();
+
+    /**
+     * Method to execute the query where there are (potentially) multiple rows and we are
returning a result type for the specified result.
+     * @param resultCls The result class
+     * @return List of result objects
+     * @param <R> The result type
+     */
+    <R> List<R> executeResultList(Class<R> resultCls);
+
+    /**
+     * Method to execute the query where there is a single row and we are returning a result
type for the specified result.
+     * @param resultCls The result class
+     * @return The result object (or null)
+     * @param <R> The result type
+     */
+    <R> R executeResultUnique(Class<R> resultCls);
+
+    /**
+     * Method to execute the query where there are (potentially) multiple rows and we have
a result defined but no result class.
+     * @return The list of query results
+     */
+    List<Object> executeResultList();
+
+    /**
+     * Method to execute the query where there is a single row and we have a result defined
but no result class.
+     * @return The query result (or null)
+     */
+    Object executeResultUnique();
 }



Mime
View raw message