You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Ola Berg <ol...@arkitema.se> on 2002/06/17 11:59:52 UTC

[reflect][collection] Predicate - a question

Done some coding.

+1 on Dmitris suggestion org.apache.commons.reflect and org.apache.commons.reflect.introspection. Or similar division.

Made concrete static inner classes Predicate.And Predicate.Or Predicate.Not, since I saw that this was missing in Collection-2.0. But I suspect this is already implemented in CVS somewhere. Is there public read-only access to the CVS for these things?

Put Predicate in lang.

Made abstract base class MethodPredicate (implements Predicate) for type assertion. Now the question to Predicate/Collection-wizards: What\'s the deal with Predicate: if the Object input that should be evaluated has the wrong class, do you rather throw like ClassCastException or let the Predicate#evaluate() return false? I can see that different situations call for different \"assertion schemes\" in that matter, what\'s the regular view on this?

/O

--------------------
ola.berg@arkitema.se
0733 - 99 99 17

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [reflect][collection] Predicate - a question

Posted by Juozas Baliuka <ba...@mwm.lt>.
Hi,
At 11:59 2002.06.17 +0200, Ola Berg wrote:
>Done some coding.
>
>+1 on Dmitris suggestion org.apache.commons.reflect and 
>org.apache.commons.reflect.introspection. Or similar division.
>
>Made concrete static inner classes Predicate.And Predicate.Or 
>Predicate.Not, since I saw that this was missing in Collection-2.0. But I 
>suspect this is already implemented in CVS somewhere. Is there public 
>read-only access to the CVS for these things?
>
>Put Predicate in lang.
>
>Made abstract base class MethodPredicate (implements Predicate) for type 
>assertion. Now the question to Predicate/Collection-wizards: What\'s the 
>deal with Predicate: if the Object input that should be evaluated has the 
>wrong class, do you rather throw like ClassCastException or let the 
>Predicate#evaluate() return false? I can see that different situations 
>call for different \"assertion schemes\" in that matter, what\'s the 
>regular view on this?

  I prefer subclass or some kind of "decorator" for typed collections like 
"class Properties extends Hashtable" or "new Attributes(map)",
  it is situations then "runtime type" is parameter and "Predicate" is good 
solution in this case and I think it must throw ClassCastException,
if "runtime type" is "bad".





>/O
>
>--------------------
>ola.berg@arkitema.se
>0733 - 99 99 17
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>