1 /* |
1 /* |
2 * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
49 * without supplying a heavyweight query language along with the processing that |
49 * without supplying a heavyweight query language along with the processing that |
50 * such a query language would require. |
50 * such a query language would require. |
51 * <p> |
51 * <p> |
52 * A JDBC <code>FilteredRowSet</code> standard implementation implements the |
52 * A JDBC <code>FilteredRowSet</code> standard implementation implements the |
53 * <code>RowSet</code> interfaces and extends the |
53 * <code>RowSet</code> interfaces and extends the |
54 * <code>CachedRowSet</code><sup><font size=-2>TM</font></sup> class. The |
54 * <code>CachedRowSet</code>™ class. The |
55 * <code>CachedRowSet</code> class provides a set of protected cursor manipulation |
55 * <code>CachedRowSet</code> class provides a set of protected cursor manipulation |
56 * methods, which a <code>FilteredRowSet</code> implementation can override |
56 * methods, which a <code>FilteredRowSet</code> implementation can override |
57 * to supply filtering support. |
57 * to supply filtering support. |
58 * |
58 * |
59 * <h3>2.0 Predicate Sharing</h3> |
59 * <h3>2.0 Predicate Sharing</h3> |
67 * <p> |
67 * <p> |
68 * By implementing a <code>Predicate</code> (see example in <a href="Predicate.html">Predicate</a> |
68 * By implementing a <code>Predicate</code> (see example in <a href="Predicate.html">Predicate</a> |
69 * class JavaDoc), a <code>FilteredRowSet</code> could then be used as described |
69 * class JavaDoc), a <code>FilteredRowSet</code> could then be used as described |
70 * below. |
70 * below. |
71 * <P> |
71 * <P> |
72 * <code> |
|
73 * <pre> |
72 * <pre> |
|
73 * {@code |
74 * FilteredRowSet frs = new FilteredRowSetImpl(); |
74 * FilteredRowSet frs = new FilteredRowSetImpl(); |
75 * frs.populate(rs); |
75 * frs.populate(rs); |
76 * |
76 * |
77 * Range name = new Range("Alpha", "Bravo", "columnName"); |
77 * Range name = new Range("Alpha", "Bravo", "columnName"); |
78 * frs.setFilter(name); |
78 * frs.setFilter(name); |
79 * |
79 * |
80 * frs.next() // only names from "Alpha" to "Bravo" will be returned |
80 * frs.next() // only names from "Alpha" to "Bravo" will be returned |
|
81 * } |
81 * </pre> |
82 * </pre> |
82 * </code> |
|
83 * In the example above, we initialize a <code>Range</code> object which |
83 * In the example above, we initialize a <code>Range</code> object which |
84 * implements the <code>Predicate</code> interface. This object expresses |
84 * implements the <code>Predicate</code> interface. This object expresses |
85 * the following constraints: All rows outputted or modified from this |
85 * the following constraints: All rows outputted or modified from this |
86 * <code>FilteredRowSet</code> object must fall between the values 'Alpha' and |
86 * <code>FilteredRowSet</code> object must fall between the values 'Alpha' and |
87 * 'Bravo' both values inclusive, in the column 'columnName'. If a filter is |
87 * 'Bravo' both values inclusive, in the column 'columnName'. If a filter is |