Class NodeSortTool


  • public class NodeSortTool
    extends org.apache.velocity.tools.generic.SortTool
    This class is used to sort a list of XML nodes retrieved using the org.jdom.xpath.XPath class simulating the functionality of the element (and possibly multiple elements) in XSLT. It also inherits all the functionality of Apache's SortTool
    Since:
    6.2
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.velocity.tools.generic.SortTool

        org.apache.velocity.tools.generic.SortTool.PropertiesComparator
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeSortTool()
      Initializes a newly created NodeSortTool object so that multiple sets of attributes may be bundled in order sort a list of XML nodes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSortCriterion​(java.lang.String select, java.lang.String lang, java.lang.String dataType, java.lang.String order, java.lang.String caseOrder)
      Adds a new set of parameters to be used as a sort criterion.
      java.util.Collection sort​(java.util.Collection elements)  
      • Methods inherited from class org.apache.velocity.tools.generic.SortTool

        getComparable, internalSort, sort, sort, sort, sort, sort, sort
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NodeSortTool

        public NodeSortTool()
        Initializes a newly created NodeSortTool object so that multiple sets of attributes may be bundled in order sort a list of XML nodes.
    • Method Detail

      • sort

        public java.util.Collection sort​(java.util.Collection elements)
        Overrides:
        sort in class org.apache.velocity.tools.generic.SortTool
      • addSortCriterion

        public void addSortCriterion​(java.lang.String select,
                                     java.lang.String lang,
                                     java.lang.String dataType,
                                     java.lang.String order,
                                     java.lang.String caseOrder)
        Adds a new set of parameters to be used as a sort criterion. Properties supplied mimic sthose of the element. Any unrecognized parameters are replaced by their default value. This method can be called multiple times before sorting to apply multiple criteria.
        Parameters:
        select - An XPath-expression specifying the node/node-set to sort on
        lang - A lowercase two-letter ISO-639 code that specifies which language is to be used by the sort. Default is "en".
        dataType - Either "text", "number", or "qname"; specifies the data-type of the data to be sorted. Default is "text".
        order - Either "ascending" or "descending"; specifies the sort order. Default is "ascending".
        caseOrder - Either "lower-first" or "upper-first"; specifies whether upper- or lowercase letters are to be ordered first. Default is "lower-first".