com.holonplatform.vaadin.flow.data

## Interface ItemConverter<T,ITEM>

- Type Parameters:
    `T` - Value type
    `ITEM` - Item type

      public interface ItemConverter<T,ITEM>

  Item to value converter.
  Since:
    5.2.0

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T,ITEM> ItemConverter<T,ITEM>` | `create(Function<ITEM,T> toValue, Function<T,Optional<ITEM>> toItem)` Create a new `ItemConverter` using given functions to perform conversions.
    `Optional<ITEM>` | `getItem(T value)` Convert a `value` into an item instance, if available.
    `T` | `getValue(ITEM item)` Convert an `item` instance into the required value type.
    `static <T> ItemConverter<T,T>` | `identity()` Create a new `ItemConverter` for consistent item and value types, which do not perform any conversion.

- - ### Method Detail

    - #### getValue

          T getValue(ITEM item)

      Convert an `item` instance into the required value type.
      Parameters:
        `item` - Item instance
      Returns:
        The converted value

    - #### getItem

          Optional<ITEM> getItem(T value)

      Convert a `value` into an item instance, if available.
      Parameters:
        `value` - The value to convert
      Returns:
        Optional item instance

    - #### create

          static <T,ITEM> ItemConverter<T,ITEM> create(Function<ITEM,T> toValue,
                                                       Function<T,Optional<ITEM>> toItem)

      Create a new `ItemConverter` using given functions to perform conversions.
      Type Parameters:
        `T` - Value type
        `ITEM` - Item type
      Parameters:
        `toValue` - Function to convert the item into a value (not null)
        `toItem` - Function to convert the value into an item, if available (not null)
      Returns:
        A new `ItemConverter`

    - #### identity

          static <T> ItemConverter<T,T> identity()

      Create a new `ItemConverter` for consistent item and value types, which do not perform any conversion.
      Type Parameters:
        `T` - Value and item type
      Returns:
        A new identity `ItemConverter`

Copyright © 2019 The Holon Platform. All rights reserved.