On 6/16/11 1:06 , Niclas Hedhman wrote:
I "had to" do the 'hard way' since I needed to deliver and then it has
been forgotten...
Ok, in that case I would propose that this is added. And, thinking about
it some more considering the functional programming changes I've been
working on, the interface would probably simply be:
public void withState(Function<PropertyDescriptor,Object> state);
I've been testing using Specification and Function in other places, and
have for example successfully implemented an alternative for query
expressions, where instead of BooleanExpression I simply use
Specification<Entity>.
Then the basic operators look like this:
public static <T> Specification<Entity> eq( Property<T> property,
Value<T> value )
{
return new EqSpecification<T>( property( property ), value );
}
and binary operators become:
public static Specification<Entity> and(Specification<Entity> left,
Specification<Entity> right, Specification<Entity>... optionalRight)
{
return new AndSpecification(prepend( left, prepend( right,
iterable( optionalRight ) ) ));
}
This, I think, makes it easier to add custom operators for when you know
the underlying EntityFinder is a specific one. All you need to do is
provide a static operator that returns a Specification<Entity> and
you're good to go. The EntityFinder can then translate that into
whatever the internal expression language uses.
/Rickard
_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev