EnumMappie

abstract class EnumMappie<FROM : Enum<*>, TO> : Mappie<TO>

Base class for enum mappers. See the documentation for a complete overview of how to generate enum mappers.

For example

class PersonMapper : EnumMappie<Color, Colour>() {
override fun map(from: Color) = mapping()
}

will generate a mapper from Color to Colour, assuming both Color and Colour have a resolvable mapping.

Parameters

FROM

the source type to map from.

TO

the target type to map to.

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
open fun map(from: FROM): TO

Map from to an instance of TO.

Link copied to clipboard
fun mapList(from: List<FROM>): List<TO>

Map each element in from to an instance of TO.

Link copied to clipboard
fun mapNullable(from: FROM?): TO?

Map nullable from to an instance of TO.

Link copied to clipboard
fun mapSet(from: Set<FROM>): Set<TO>

Map each element in from to an instance of TO.