Interface JRSortField

  • All Superinterfaces:
    Cloneable, JRCloneable
    All Known Implementing Classes:
    JRBaseSortField, JRDesignSortField

    public interface JRSortField
    extends JRCloneable
    Provides support for in-memory field-based data source sorting.

    JasperReports supports in-memory field-based data source sorting. This functionality can be used, for instance, when data sorting is required and the data source implementation does not support it (as in the case of the CSV data source).

    The sorting is activated by the presence of one or more <sortField> elements in the report template. When at least one sort field is specified for the report, the original report data source (either passed directly or provided by a query executer) is passed to a sorted IndexedDataSource instance that fetches all the records from it, performs an in-memory sort according to the specified fields, and replaces the original data source in the report-filling process.

    The sort field name should coincide with a report field name. Fields used for sorting should have types that implement java.util.Comparable. Sorting will be performed using the natural order for all fields except those of type java.lang.String, for which a collator corresponding to the report fill locale is used.

    When several sort fields are specified, the sorting will be performed using the fields as sort keys in the order in which they appear in the report template.

    Author:
    Teodor Danciu (teodord@users.sourceforge.net)
    See Also:
    IndexedDataSource, DatasetSortUtil, SortedDataSource
    • Method Detail

      • getName

        String getName()
        Gets the sort field name.
      • getOrder

        SortOrderEnum getOrder()
        Gets the sort order for the field.