Interface DataKeyMapper<T>

Type Parameters:
T - data type
All Superinterfaces:
Serializable
All Known Implementing Classes:
ComboBoxDataCommunicator.SelectionPreservingKeyMapper, KeyMapper

public interface DataKeyMapper<T> extends Serializable
DataKeyMapper to map data objects to key strings.
Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String key)
    Gets the data object identified by given key.
    boolean
    has(T dataObject)
    Check whether this key mapper contains the given data object.
    key(T dataObject)
    Gets the key for data object.
    void
    refresh(T dataObject)
    Updates any existing mappings of given data object.
    void
    remove(T dataObject)
    Removes a data object from the key mapping.
    void
    Removes all data objects from the key mapping.
    void
    Takes identifier getter into use and updates existing mappings
  • Method Details

    • key

      String key(T dataObject)
      Gets the key for data object. If no key exists beforehand, a new key is created.
      Parameters:
      dataObject - data object for key mapping
      Returns:
      key for given data object
    • has

      boolean has(T dataObject)
      Check whether this key mapper contains the given data object.
      Parameters:
      dataObject - the data object to check
      Returns:
      true if the given data object is contained in this key mapper, false otherwise
    • get

      T get(String key)
      Gets the data object identified by given key.
      Parameters:
      key - key of a data object
      Returns:
      identified data object; null if invalid key
    • remove

      void remove(T dataObject)
      Removes a data object from the key mapping. The key is also dropped. Dropped keys are not reused.
      Parameters:
      dataObject - dropped data object
    • removeAll

      void removeAll()
      Removes all data objects from the key mapping. The keys are also dropped. Dropped keys are not reused.
    • refresh

      void refresh(T dataObject)
      Updates any existing mappings of given data object. The equality of two data objects is determined by the equality of their identifiers provided by the given value provider.
      Parameters:
      dataObject - the data object to update
    • setIdentifierGetter

      void setIdentifierGetter(ValueProvider<T,Object> identifierGetter)
      Takes identifier getter into use and updates existing mappings
      Parameters:
      identifierGetter - has to return a unique key for every bean, and the returned key has to follow general hashCode() and equals() contract, see Object.hashCode() for details.