Hi again Sergey,
If you are only going to be using your filter programmatically (rather
than in SLD files) you can cheat a bit and set the string that you are
looking for in the filter function constructor like this...
public class Foo extends FunctionExpressionImpl {
private final String typeName;
public Foo(String typeName) {
super("Foo");
this.typeName = typeName;
}
@Override
public int getArgCount() {
return 0;
}
@Override
public Object evaluate(Object feature) {
return
(((SimpleFeature)feature).getID().matches(String.format("%s\\.\\d+",
typeName)));
}
}
Then you can use it to create a Filter like this...
FilterFactory2 ff2 = CommonFactoryFinder.getFilterFactory2(null);
org.opengis.filter.expression.Function foo = new Foo("some_name");
org.opengis.filter.Filter filter = ff2.equals(foo, ff2.literal(true));
Michael
------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users