Skip to content

Simplify FilterFactory

Jody Garnett edited this page May 25, 2021 · 3 revisions

Description

Update FilterFactory interface with methods from FilterFactory2.

Default methods for methods that are not supported may be a useful approach.

Formally this is the difference between:

  • FilterFactory - strictly limited to the data structure defined by Filter specifications
  • FilterFactory2 - allows for extensions unique to the GeoTools project

References:

Status

Choose one of:

  • Under Discussion
  • In Progress
  • Completed
  • Rejected,
  • Deferred

Voting:

  • Andrea Aime:
  • Ian Turton:
  • Jody Garnett: +1
  • Nuno Oliveira:
  • Simone Giannecchini:
  • Torben Barsballe:

Tasks

  1. Moves all methods into FilterFactory

  2. Pull up methods into FilterFactory; update javadocs to indicate what is strict OGC (for anyone who cares).

  3. Allow methods that expected a literal ISO Geometry to accept a JTS geometry.

    • Change methods using an ISO Geometry to take a Object instead
  4. Add default methods to FilterFactory to reduce the amount of coding required by implementations.

API Change

Before:

public interface FilterFactory {
    ...
    /** Checks if the feature's geometry touches, but does not overlap with the geometry held by this object. */
    Touches touches(String propertyName, Geometry geometry);
    ...
}
public interface FilterFactory2 extends FilterFactory {
    /** Checks if the feature's geometry touches, but does not overlap with the geometry held by this object. */
    Touches     touches(Expression propertyName1, Expression geometry2);
}

After:

public interface FilterFactory {
    ...
    /**
     * Checks if the feature's geometry touches, but does not overlap with the geometry held by this object.
     *
     * Defined as a propertyName and literal geometry comparison following OGC Filter and CQL specifications.
     */
    Touches touches(String propertyName, Object geometry) {
        return touches( property(propertyName), literal(geometry) );
    }
    /**
     * Checks if the feature's geometry touches, but does not overlap with a second geometry.
     */
    Touches touches(Expression geometry1, Expression geometry2);
    ...
}
public interface FilterFactory2 extends FilterFactory {
    // empty
}
Clone this wiki locally