public interface FilteredRowSet extends WebRowSet
The standard interface that all standard implementations of
FilteredRowSet must implement. The
FilteredRowSetImpl class provides the reference implementation which may be extended if required. Alternatively, a vendor is free to implement its own version by implementing this interface.
RowSetobject has a need to provide a degree of filtering to its contents. One possible solution is to provide a query language for all standard
RowSetimplementations; however, this is an impractical approach for lightweight components such as disconnected
FilteredRowSetinterface seeks to address this need without supplying a heavyweight query language along with the processing that such a query language would require.
FilteredRowSet standard implementation implements the
RowSet interfaces and extends the
CachedRowSet™ class. The
CachedRowSet class provides a set of protected cursor manipulation methods, which a
FilteredRowSet implementation can override to supply filtering support.
FilteredRowSetimplementation is shared using the inherited
createSharedmethod in parent interfaces, the
Predicateshould be shared without modification by all
By implementing a
Predicate (see example in Predicate class JavaDoc), a
FilteredRowSet could then be used as described below.
FilteredRowSet frs = new FilteredRowSetImpl(); frs.populate(rs); Range name = new Range("Alpha", "Bravo", "columnName"); frs.setFilter(name); frs.next() // only names from "Alpha" to "Bravo" will be returnedIn the example above, we initialize a
Rangeobject which implements the
Predicateinterface. This object expresses the following constraints: All rows outputted or modified from this
FilteredRowSetobject must fall between the values 'Alpha' and 'Bravo' both values inclusive, in the column 'columnName'. If a filter is applied to a
FilteredRowSetobject that contains no data that falls within the range of the filter, no rows are returned.
This framework allows multiple classes implementing predicates to be used in combination to achieved the required filtering result with out the need for query language processing.
FilteredRowSetobject applies a criterion on all rows in a
RowSetobject to manage a subset of rows in a
RowSetobject. This criterion governs the subset of rows that are visible and also defines which rows can be modified, deleted or inserted.
Therefore, the predicate set on a
FilteredRowSet object must be considered as bi-directional and the set criterion as the gating mechanism for all views and updates to the
FilteredRowSet object. Any attempt to update the
FilteredRowSet that violates the criterion will result in a
SQLException object being thrown.
FilteredRowSet range criterion can be modified by applying a new
Predicate object to the
FilteredRowSet instance at any time. This is possible if no additional references to the
FilteredRowSet object are detected. A new filter has has an immediate effect on criterion enforcement within the
FilteredRowSet object, and all subsequent views and updates will be subject to similar enforcement.
FilteredRowSetobject cannot be modified until the filter is removed or a new filter is applied.
Furthermore, only rows that fall within the bounds of a filter will be synchronized with the data source.
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
void setFilter(Predicate p) throws SQLException
Applies the given
Predicate object to this
FilteredRowSet object. The filter applies controls both to inbound and outbound views, constraining which rows are visible and which rows can be manipulated.
Predicate object may be set at any time. This has the effect of changing constraints on the
RowSet object's data. In addition, modifying the filter at runtime presents issues whereby multiple components may be operating on one
FilteredRowSet object. Application developers must take responsibility for managing multiple handles to
FilteredRowSet objects when their underling
Predicate objects change.
Predicateobject defining the filter for this
FilteredRowSetobject. Setting a null value will clear the predicate, allowing all rows to become visible.
SQLException- if an error occurs when setting the
Retrieves the active filter for this
nullif no filter has been set.
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.