commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject Re: [Collections][SUBMIT] TypedList
Date Tue, 23 Apr 2002 19:48:54 GMT
What would a Predicate look like?

We've passed an object in, so it must have the object being added (or
removed/searched for etc???).

So I'm guessing in Predicate(d)List we'll do some code kinda like:

// uses ArrayList internally, can supply another type of List somehow.
List list = new PredicatedList( new TypePredicate(String.class) );

list.add("foo");

This would do in the TypePredicate:

public boolean check(Object obj) {
    return BeansUtil.instanceof(obj, myType);
}

or some such. I imagine the Predicate should have access to the list it
came from, so it would have a setCollection setMap? interface? Something.

public void setStructure(Object structure).

Then I can have a predicate which says, let the first person in, then let
no one else in who has a birthday of <birthday>.

I would also then imagine a MultiPredicate which takes a bunch of
Predicates and only allows things if each one works.

*ponder* I'm starting to waffle.

Hen


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message