T - Value typeITEM - Item typepublic interface ItemConverter<T,ITEM>
| 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. |
T getValue(ITEM item)
item instance into the required value type.item - Item instanceOptional<ITEM> getItem(T value)
value into an item instance, if available.value - The value to convertstatic <T,ITEM> ItemConverter<T,ITEM> create(Function<ITEM,T> toValue, Function<T,Optional<ITEM>> toItem)
ItemConverter using given functions to perform conversions.T - Value typeITEM - Item typetoValue - Function to convert the item into a value (not null)toItem - Function to convert the value into an item, if available (not null)ItemConverterstatic <T> ItemConverter<T,T> identity()
ItemConverter for consistent item and value types, which do not perform any conversion.T - Value and item typeItemConverterCopyright © 2019 The Holon Platform. All rights reserved.