Package com.rosetta.model.lib.mapper
Class MapperC<T>
java.lang.Object
com.rosetta.model.lib.mapper.MapperC<T>
- All Implemented Interfaces:
Mapper<T>,MapperBuilder<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.rosetta.model.lib.mapper.Mapper
Mapper.Path -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<F> FApply a function to this mapperbooleanfilterItem(Predicate<MapperS<T>> predicate) filterItemNullSafe(Function<MapperS<T>, Boolean> predicate) Filter items of list based on the given predicate.first()Gets first item of the list.get()Get item at specified index, returns null if index out of bounds.Stream<MapperItem<? extends T, ?>> getItems()getMulti()getOrDefault(T defaultValue) Optional<?> List<?> getPaths()inthashCode()Concatenate list of strings, separating each item with delimiter.last()Gets last item of the list.<F> MapperC<F> map(NamedFunction<T, F> mappingFunc) Maps list parent item to single child item.<F> MapperC<F> Helper function to map a value with single cardinality<F> MapperC<F> mapC(NamedFunction<T, List<? extends F>> mappingFunc) Maps list parent item to list child item.<F> MapperC<F> Helper function to map a value with multiple cardinality<F> MapperC<F> Map items of a list based on the given mapping function.<F> MapperListOfLists<F> mapItemToList(Function<MapperS<T>, MapperC<F>> mappingFunc) Map items of a list based on the given mapping function.<F extends Comparable<F>>
MapperS<T> max()Get maximum item from a list of comparable items.<F extends Comparable<F>>
MapperS<T> Get item from list based on maximum item attribute (provided by comparableGetter)<F extends Comparable<F>>
MapperS<T> min()Get minimum item from a list of comparable items.<F extends Comparable<F>>
MapperS<T> Get item from list based on minimum item attribute (provided by comparableGetter)protected Stream<MapperItem<? extends T, ?>> static <T> MapperC<T> of(MapperBuilder<? extends T>... ts) static <T> MapperC<T> static <T> MapperC<T> ofNull()<F> MapperS<F> reduce(MapperS<F> initial, BinaryOperator<MapperS<F>> reduceFunc) Reduce list items to single item based on the given reduce function.<F> MapperS<F> reduce(BinaryOperator<MapperS<F>> reduceFunc) Reduce list items to single item based on the given reduce function.removeItem(MapperS<Integer> indexGetter) Remove item at specified index, returns list without removed item.intreverse()Reverse items of a list.sort()Sort list of comparable items.<F extends Comparable<F>>
MapperC<T> Sort list of items based on comparable attribute.Sum list of numbers.Sum list of numbers.Sum list of integers.sumLong()Sum list of longs.toString()unionDifferent(MapperBuilder<?> other) unionSame(MapperBuilder<T> other) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.rosetta.model.lib.mapper.MapperBuilder
convert, findParent
-
Constructor Details
-
MapperC
-
-
Method Details
-
ofNull
-
of
-
of
-
map
Description copied from interface:MapperBuilderHelper function to map a value with single cardinality- Specified by:
mapin interfaceMapperBuilder<T>
-
map
Maps list parent item to single child item.- Specified by:
mapin interfaceMapperBuilder<T>
-
mapC
Description copied from interface:MapperBuilderHelper function to map a value with multiple cardinality- Specified by:
mapCin interfaceMapperBuilder<T>
-
mapC
Maps list parent item to list child item.- Specified by:
mapCin interfaceMapperBuilder<T>
-
filterItem
- Parameters:
predicate- - test that determines whether to filter list item. True to include in list, and false to exclude.- Returns:
- filtered list
-
filterItemNullSafe
Filter items of list based on the given predicate.- Parameters:
predicate- - test that determines whether to filter list item. True to include in list, and false to exclude.- Returns:
- filtered list
-
mapItem
Map items of a list based on the given mapping function.- Type Parameters:
F-- Parameters:
mappingFunc-- Returns:
- mapped list
-
mapItemToList
Map items of a list based on the given mapping function.- Type Parameters:
F-- Parameters:
mappingFunc-- Returns:
- mapped list
-
apply
Apply a function to this mapper -
reduce
Reduce list items to single item based on the given reduce function.- Type Parameters:
F-- Parameters:
reduceFunc-- Returns:
- reduced item
-
reduce
Reduce list items to single item based on the given reduce function.- Type Parameters:
F-- Parameters:
reduceFunc-- Returns:
- reduced item
-
sumInteger
Sum list of integers.- Returns:
- total of summed integers.
-
sumLong
Sum list of longs.- Returns:
- total of summed longs.
-
sumBigInteger
Sum list of numbers.- Returns:
- total of summed numbers.
-
sumBigDecimal
Sum list of numbers.- Returns:
- total of summed numbers.
-
join
Concatenate list of strings, separating each item with delimiter.- Parameters:
delimiter- - item separator- Returns:
- concatenated string
-
min
Get minimum item from a list of comparable items.- Returns:
- minimum
-
min
Get item from list based on minimum item attribute (provided by comparableGetter)- Type Parameters:
F-- Parameters:
comparableGetter- - getter for comparable attribute- Returns:
- minimum
-
max
Get maximum item from a list of comparable items.- Returns:
- maximum
-
max
Get item from list based on maximum item attribute (provided by comparableGetter)- Type Parameters:
F-- Parameters:
comparableGetter- - getter for comparable attribute- Returns:
- maximum
-
sort
Sort list of comparable items.- Returns:
- sorted list
-
sort
Sort list of items based on comparable attribute.- Type Parameters:
F- comparable type- Parameters:
comparableGetter- to get comparable item to sort by- Returns:
- sorted list
-
reverse
Reverse items of a list.- Returns:
- reversed list
-
first
Gets first item of the list.- Returns:
- first list item
-
last
Gets last item of the list.- Returns:
- last list item
-
getItem
Get item at specified index, returns null if index out of bounds.- Returns:
- list item at index
-
removeItem
Remove item at specified index, returns list without removed item.- Returns:
- list without specified item
-
nonErrorItems
-
get
-
getOrDefault
- Specified by:
getOrDefaultin interfaceMapper<T>
-
getMulti
-
getParent
-
getParentMulti
- Specified by:
getParentMultiin interfaceMapper<T>
-
resultCount
public int resultCount()- Specified by:
resultCountin interfaceMapper<T>
-
getPaths
-
getErrorPaths
- Specified by:
getErrorPathsin interfaceMapper<T>
-
getErrors
-
toString
-
unionSame
- Specified by:
unionSamein interfaceMapperBuilder<T>
-
unionDifferent
- Specified by:
unionDifferentin interfaceMapperBuilder<T>
-
hashCode
public int hashCode() -
equals
-
getItems
- Specified by:
getItemsin interfaceMapperBuilder<T>
-