It can be.

On Wed, Apr 15, 2009 at 2:13 PM, Johan Compagner <[email protected]> wrote:
> is a Predicate  serializable?
>
> On Wed, Apr 15, 2009 at 18:05, Charles A Deal <[email protected]> wrote:
>
>> I have a number of Form Components that have a conditional required
>> status.  In the past, I've seen recommendations to override the component
>> and supply a custom implementation of the isRequired function to support
>> the proper check.  So, in this case, it ignores the boolean that might be
>> set by the user.  I understand and agree that that is a reasonable
>> solution.
>>
>> In my environment, I have helper functions that, given some parameters,
>> build the appropriate components along with labels, validators, behaviors,
>> etc.  In order to subclass the Form Components, I would have to give up
>> that function and, basically, code capture what it does for each instance
>> that needs a custom isRequired method.  I also have a security
>> implementation that uses a Predicate instance (org.apache.commons.
>> collections) to control both the RENDER and ENABLED state of a component
>> and it seems natural (in my environment) to be able to use a Predicate for
>> the isRequired function, as well.
>>
>> I am soliciting feedback on the idea.  I don't want to have a completely
>> derivative set of FormComponents that support this feature, so I would
>> probably modify the main codebase to add the support to all
>> FormComponents.  My thought is that I would add a
>> setRequiredFunction(Predicate) method that would store the predicate in
>> MetaData.  The isRequired() method would be adjusted to be something like
>>
>> public boolean isRequired() {
>>        Predicate func = <get Predicate from MetaData>
>>        if (func != null) {
>>                return func.evaluate(this);
>>        } else {
>>                return getFlag(FLAG_REQUIRED);
>>        }
>> }
>>
>> Can anyone tell me why this WOULDN'T work?  What might some shortcomings
>> be?  Would Wicket core be interested in this?  If not,  why not (it might
>> offer insight as to why this is a bad idea)?  Would this add too much
>> overhead to be worthwhile?
>>
>>  If you think this is a good idea, why?  And would you do anything
>> differently to make this a stronger concept?
>>
>> Thanks for your feedback, I appreciate your time.
>>
>> Charles Deal
>>
>>
>>
>> This is a PRIVATE message. If you are not the intended recipient, please
>> delete without copying and kindly advise us by e-mail of the mistake in
>> delivery.
>> NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
>> any order or other contract unless pursuant to explicit written agreement
>> or government initiative expressly permitting the use of e-mail for such
>> purpose.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to