// grab the feature collection and run the min/max visitors (this will move the
// query to the dbms in case of such data source)
Query q = new Query();
q.setPropertyNames(new String[] {attribute.getName()});
FeatureCollection fc = fs.getFeatures(q);
MinVisitor minVisitor = new MinVisitor(attribute.getName());
MaxVisitor maxVisitor = new MaxVisitor(attribute.getName());
fc.accepts(minVisitor, null);
fc.accepts(maxVisitor, null);
Object min = minVisitor.getResult().getValue();
attribute.setMin(Converters.convert(min, String.class));
Object max = maxVisitor.getResult().getValue();
attribute.setMax(Converters.convert(max, String.class));
}