Package com.onec.ui

Class WidgetAggregate

java.lang.Object
com.onec.ui.WidgetAggregate

public final class WidgetAggregate extends Object
Builds the SQL aggregate expression for a count/metric card. count needs no column; sum/avg/min/max aggregate a single numeric column, which must be one of the entity's known columns (so the metric field can never carry arbitrary SQL). sum coalesces to zero so an empty table reads as 0 rather than null.
  • Method Details

    • expression

      public static String expression(String metric, String field, Set<String> columns)
      Parameters:
      metric - one of count|sum|avg|min|max (null/blank → count)
      field - the column to aggregate; required for everything but count
      columns - the entity's valid column names
      Throws:
      IllegalArgumentException - if the metric is unknown, or the field is missing/unknown