Class KeyValueListFilter<T>

java.lang.Object
xal.tools.data.KeyValueListFilter<T>

public class KeyValueListFilter<T> extends Object
filter a list of objects according to the values associated with the specified keys
  • Constructor Details

    • KeyValueListFilter

      public KeyValueListFilter(KeyValueAdaptor adaptor, List<T> allRecords, String... matchingKeyPaths)
      Primary Constructor
      Parameters:
      adaptor - key value adaptor to use to get the keyed values for the objects
      allRecords - all of the objects to filter
      matchingKeyPaths - the key paths corresponding to an object's keyed values to use for matching
  • Method Details

    • setAllRecords

      public void setAllRecords(List<T> allRecords)
      Set the list of all objects to filter
    • setMatchingKeyPaths

      public void setMatchingKeyPaths(String... matchingKeyPaths)
      Set the matching key paths
    • indexRecords

      public void indexRecords()
      index all records by the keyed values in the list
    • reIndexRecord

      public void reIndexRecord(T recordType)
      re-index the specified record (e.g. if a value in the record has changed )
    • filterRecordsTo

      public void filterRecordsTo(String text, List<T> matchingRecords)
      Filter the records for those that match (case insensitive) every word in the specified text.
      Parameters:
      text - the text whose every word is matched against each record
      matchingRecords - the container (first gets cleared) into which the matching records are placed preserving order
    • filterRecords

      public List<T> filterRecords(String text)
      Filter the records for those that match (case insensitive) every word in the specified text.
      Parameters:
      text - the text whose every word is matched against each record
      Returns:
      the list of matching records preserving order