db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject svn commit: r1021723 - in /db/jdo/site: docs/jdoql_methods.html xdocs/jdoql_methods.xml
Date Tue, 12 Oct 2010 10:05:01 GMT
Author: andyj
Date: Tue Oct 12 10:05:01 2010
New Revision: 1021723

URL: http://svn.apache.org/viewvc?rev=1021723&view=rev
Log:
JDO3.1 List.get, and example of String.matches

Modified:
    db/jdo/site/docs/jdoql_methods.html
    db/jdo/site/xdocs/jdoql_methods.xml

Modified: db/jdo/site/docs/jdoql_methods.html
URL: http://svn.apache.org/viewvc/db/jdo/site/docs/jdoql_methods.html?rev=1021723&r1=1021722&r2=1021723&view=diff
==============================================================================
--- db/jdo/site/docs/jdoql_methods.html (original)
+++ db/jdo/site/docs/jdoql_methods.html Tue Oct 12 10:05:01 2010
@@ -21,6 +21,22 @@ Query query = pm.newQuery(
     "SELECT FROM mydomain.Product " +
     "WHERE :tradeName.startsWith(this.abbreviation)");
 List results = (List)query.execute("Workbook Advanced");</pre></div>
+  <br></br><p>
+                    Here's another example, demonstrating the "matches" method.
+                    Consult the javadocs for Java regular expressions for the
+                    syntax of the matches input.
+                </p>
+    <div class="source"><pre>
+Declarative JDOQL :
+Query query = pm.newQuery(mydomain.Product.class);
+query.setFilter("this.abbreviation.matches(\"a*b\")");
+List results = (List)query.execute();
+
+Single-String JDOQL :
+Query query = pm.newQuery(
+    "SELECT FROM mydomain.Product " +
+    "WHERE this.abbreviation.matches(\"a*b\")");
+List results = (List)query.execute();</pre></div>
   <br></br></div><div class="subsection"><a name="Collection_Methods"></a><h3>Collection
Methods</h3><table class="bodyTable"><tr class="b"><th width="220">Method</th><th>Description</th></tr><tr
class="a"><td>isEmpty()</td><td>Returns whether the collection is empty</td></tr><tr
class="b"><td>contains(value)</td><td>Returns whether the collection
contains the passed element</td></tr><tr class="a"><td>size()</td><td>Returns
the number of elements in the collection</td></tr></table><p>
                     Here's an example demonstrating use of contains(). We have an Inventory
class that has a
                     Collection of Product objects, and we want to find the Inventory objects
with 2 particular 
@@ -38,7 +54,7 @@ Query query = pm.newQuery(
     "SELECT FROM mydomain.Inventory EXCLUDE SUBCLASSES " + 
     "WHERE products.contains(prd) &amp;&amp; (prd.name==\"product 1\" || prd.name==\"product
2\")");
 List results = (List)query.execute();</pre></div>
-  <br></br></div><div class="subsection"><a name="Map_Methods"></a><h3>Map
Methods</h3><table class="bodyTable"><tr class="b"><th width="220">Method</th><th>Description</th></tr><tr
class="a"><td>isEmpty()</td><td>Returns whether the map is empty</td></tr><tr
class="b"><td>containsKey(key)</td><td>Returns whether the map contains
the passed key</td></tr><tr class="a"><td>containsValue(value)</td><td>Returns
whether the map contains the passed value</td></tr><tr class="b"><td>get(key)</td><td>Returns
the value from the map with the passed key</td></tr><tr class="a"><td>size()</td><td>Returns
the number of entries in the map</td></tr></table><p>
+  <br></br></div><div class="subsection"><a name="List_Methods"></a><h3>List
Methods</h3><table class="bodyTable"><tr class="b"><th width="220">Method</th><th>Description</th></tr><tr
class="a"><td>get(position)</td><td>Returns the element at that position
in the List (JDO3.1)</td></tr></table><br></br></div><div
class="subsection"><a name="Map_Methods"></a><h3>Map Methods</h3><table
class="bodyTable"><tr class="b"><th width="220">Method</th><th>Description</th></tr><tr
class="a"><td>isEmpty()</td><td>Returns whether the map is empty</td></tr><tr
class="b"><td>containsKey(key)</td><td>Returns whether the map contains
the passed key</td></tr><tr class="a"><td>containsValue(value)</td><td>Returns
whether the map contains the passed value</td></tr><tr class="b"><td>get(key)</td><td>Returns
the value from the map with the passed key</td></tr><tr class="a"><td>size()</td><td>Returns
the number of entries in the map</td></tr></table><p>
                     Here's an example using a Product class as a value in a Map. Our example
represents an 
                     organisation that has several Inventories of products. Each Inventory
of products is stored 
                     using a Map, keyed by the Product name. The query searches for all Inventories
that contain a 

Modified: db/jdo/site/xdocs/jdoql_methods.xml
URL: http://svn.apache.org/viewvc/db/jdo/site/xdocs/jdoql_methods.xml?rev=1021723&r1=1021722&r2=1021723&view=diff
==============================================================================
--- db/jdo/site/xdocs/jdoql_methods.xml (original)
+++ db/jdo/site/xdocs/jdoql_methods.xml Tue Oct 12 10:05:01 2010
@@ -72,6 +72,23 @@ Query query = pm.newQuery(
     "WHERE :tradeName.startsWith(this.abbreviation)");
 List results = (List)query.execute("Workbook Advanced");]]></source>
                 <br/>
+                <p>
+                    Here's another example, demonstrating the "matches" method.
+                    Consult the javadocs for Java regular expressions for the
+                    syntax of the matches input.
+                </p>
+                <source><![CDATA[
+Declarative JDOQL :
+Query query = pm.newQuery(mydomain.Product.class);
+query.setFilter("this.abbreviation.matches(\"a*b\")");
+List results = (List)query.execute();
+
+Single-String JDOQL :
+Query query = pm.newQuery(
+    "SELECT FROM mydomain.Product " +
+    "WHERE this.abbreviation.matches(\"a*b\")");
+List results = (List)query.execute();]]></source>
+                <br/>
             </subsection>
 
             <subsection name="Collection Methods">
@@ -113,6 +130,20 @@ List results = (List)query.execute();]]>
                 <br/>
             </subsection>
 
+            <subsection name="List Methods">
+                <table>
+                    <tr>
+                        <th width="220">Method</th>
+                        <th>Description</th>
+                    </tr>
+                    <tr>
+                        <td>get(position)</td>
+                        <td>Returns the element at that position in the List (JDO3.1)</td>
+                    </tr>
+                </table>
+                <br/>
+            </subsection>
+
             <subsection name="Map Methods">
                 <table>
                     <tr>



Mime
View raw message