Anyone feeling smarter than me? I am stuck on the following generics
puzzle... from SubFeatureList, this is the code that compares the
attribute values; in order to produce a List<String> of FeatureIds
capturing the "sorted" content.
Question is what to do about Comparable ... Compareable<?> does not
work; since all I really know is that these two things are objects; in
Java 1.4 you could throw an Object at any Comparable implementation and
hope for the best; I am a bit worried I need to do instanceof checks here.
> protected int compare( SimpleFeature feature1,
> SimpleFeature feature2, SortBy order){
> PropertyName name = order.getPropertyName();
> Comparable value1 = (Comparable)
> name.evaluate( feature1 );
> Comparable value2 = (Comparable)
> name.evaluate( feature2 );
>
> if( order.getSortOrder() == SortOrder.ASCENDING ){
> return value1.compareTo( value2 );
> }
> else return value2.compareTo( value1
> );
> }
Jody
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel