About Question enthuware.ocpjp.v7.2.1268 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Student
Posts: 53
Joined: Fri Sep 20, 2013 7:20 am
Contact:

About Question enthuware.ocpjp.v7.2.1268 :

Post by Student »

Hi,

Erm, seems like dodgy wordage is being used here:
You can supply an instance of only one Predicate class to set a condition for a FilteredRowSet.
Whereas (http://docs.oracle.com/javase/tutorial/ ... ta-further):
You set multiple filters serially. The first time you call the method setFilter and pass it a Predicate object, you have applied the filtering criteria in that filter. After calling the method next on each row, which makes visible only those rows that satisfy the filter, you can call setFilter again, passing it a different Predicate object. Even though only one filter is set at a time, the effect is that both filters apply cumulatively.
It was because I had read this that I was confused by the answers...choosing the only other one that I didn't *know* to be false (the silly Assertion interface one..very silly and very wrong). Maybe the "correct" answer could do with a subtle rewording? Maybe you mean if you have 2 different implementations of Predicate (class X implements Predicate{...}, class Y implements Predicate{...}, you can only use one of them in any given FilteredRowSet object, even though you can apply multiple instances of it? Is that what you mean?

Cheers.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1268 :

Post by admin »

You are right. The wording it not good. It should say something like, "You can supply an instance of only one Predicate class at a time to set a condition for a FilteredRowSet." because there is no method that takes multiple predicate instances at the same time.

thank you for your feedback!
Paul.

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1268 :

Post by admin »

BTW, the API description for this method seems to say the opposite: http://docs.oracle.com/javase/7/docs/ap ... Predicate)
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.
A new 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.
It doesn't say anything about cumulative effect.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests