public static boolean hasMaxRows(RowSelection selection) {
return selection != null && selection.getMaxRows() != null && selection.getMaxRows() > 0;
}
public static boolean useLimit(LimitHandler limitHandler, RowSelection selection) {
return limitHandler.supportsLimit() && hasMaxRows( selection );
}