org.geotools.expr
Class Exprs

java.lang.Object
  extended byorg.geotools.expr.Exprs

public class Exprs
extends java.lang.Object

Filter/Expression construction kit - this class starts off chains.

I can't take Filter anymore, the turning point was the fact that I needed a FeatureType to make a AttributeExpression. Simply *no*, I cannot expect customer code to have to jump through hoops so that my impmentation is easier. Late binding is required.

The answer - while not completely forcing DataStores away from Expression/Filter is to make a class that captures all the same information and can do the late binding.

On the way there we are not going to have the difference between Filter/Expression. Expr can make an Expression, and Expr can make a Filter.

Example Expr:
Exprs.bbox( extent ).and( Exprs.attribute("cost").lt( 50 ) )

Example Filter:


 Expression extentExpression = factory.createBBoxExpression( bbox );
 Expression geomExpression = factory.createAttributeExpression( featureType, featureType.getDefaultGeometry().getName() );	    
 GeometryFilter disjointExpression = factory.createGeometryFilter( GeometryFilter.GEOMETRY_DISJOINT );
 disjointExpression.addLeftGeometry( geomExpression );
 disjointExpression.addRightGeometry( extentExpression );	    
 Filter bboxFilter = disjointExpression.not();	    
 AttributeExpression costExpression = factory.createAttributeExpression( featureType, "cost" );
 CompareFilter lessThanFilter = factory.createCompareFilter( CompareFilter.COMPARE_LESS_THAN );
 lessThanFilter.addLeftValue( costExpression );
 lessThanFilter.addRightValue( factory.createLiteralExpression( 50 ) );	    
 LogicFilter filter = factory.createLogicFilter( bboxFilter, lessThanFilter, LogicFilter.LOGIC_AND);	    
 
BTW: just so we can have everything make sense

Wild idea time: chaining parameters