Hi all,

Just working on the new feature api and came across something I though I should bring up on the list.

First off, Feature#getParent() has been deprecated and is going to die with the coming of the new api. One of the major breakages this introduces is in some of the aggregate function classes (Min, Max, Average, etc...) which do this:

public Object evaluate(Feature feature) {
  FeatureCollection featureCollection;

  if (feature instanceof FeatureCollection) {
    featureCollection = (FeatureCollection) feature;
  }
  else {
    featureCollection = feature.getParent();
  }
                
  ....

I guess my question is how to break these classes. Perhaps throw an exception like so:

public Object evaluate(Feature feature) {
  FeatureCollection featureCollection;

  if (feature instanceof FeatureCollection) {
    featureCollection = (FeatureCollection) feature;
  }

  if (featureCollection == null) {
throw new IllegalArgumentException("Function must be called with instnceof FeatureCollection");
  }

I would think as a client i would like to know right away where something is broken instead of the broken code just trying to continue on pretending everything is ok.

What do people think?

-Justin


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to